This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use shollow copy of your app data. | |
| export const appData = { | |
| defaultOrderIndex: 0, | |
| sortOrders: [{ | |
| type: 'string', | |
| name: 'Title', | |
| sortAttribute: 'title' | |
| }] | |
| // Remaining test data should be added here. | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component, OnInit, OnDestroy, Input } from '@angular/core'; | |
| import { Subscription } from 'rxjs/internal/Subscription'; | |
| import uvData from './../../data/data.json'; | |
| import { HomeService } from './home.service'; | |
| @Component({ | |
| selector: 'app-home', | |
| templateUrl: './home.component.html', | |
| styleUrls: ['./home.component.scss'] | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
| import { HomeComponent } from './home.component'; | |
| import { HomeService } from './home.service'; | |
| import * as globalmocks from '../globalmocks'; // import everything which is present in globalmocks | |
| // Function to reset to globalmocks. | |
| const resetToGlobalMocks = () => { | |
| globalmocks.HomeService.searchSubscriber$ = { | |
| subscribe: (callback) => { | |
| callback('Yuvraj'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@angular/core'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class UvUtilService { | |
| constructor() { } | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { TestBed } from '@angular/core/testing'; | |
| import * as globalmocks from '../globalmocks'; | |
| import { UvUtilService } from './uv-util.service'; | |
| describe('UvUtilService', () => { | |
| let service: UvUtilService; | |
| beforeEach(() => { | |
| TestBed.configureTestingModule({}); | |
| service = TestBed.inject(UvUtilService); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var sodexoAmount = 25; | |
| function getSalary(baseSalary) { | |
| var transportAmount = 50; | |
| function calculateSalary(hraAmount) { | |
| var specialAllowance = 75; | |
| return specialAllowance + hraAmount + baseSalary + transportAmount + sodexoAmount; | |
| } | |
| return calculateSalary; | |
| } | |
| var monthlySalary = getSalary(100); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var numberOfKingdoms = 7; | |
| setTimeout(function(){ | |
| alert('Jon should be king of ' + numberOfKingdoms + ' kingdoms'); | |
| }, 500); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var numberOfKingdoms = 7; | |
| setInterval(function(){ | |
| alert('Jon should be king of ' + numberOfKingdoms + ' kingdoms'); | |
| }, 500) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.getElementById("add-user").addEventListener("click", addUser); | |
| function addUser() { | |
| console.log('User has been added'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var uvHttp = new XMLHttpRequest(); | |
| uvHttp.onreadystatechange = function() { | |
| console.log('HTTP state change callback executed'); | |
| }; | |
| uvHttp.open("GET", "/getUser", true); | |
| uvHttp.send(); |
OlderNewer