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
| const mock = () => { | |
| let storage = {}; | |
| return { | |
| getItem: key => key in storage ? storage[key] : null, | |
| setItem: (key, value) => storage[key] = value || '', | |
| removeItem: key => delete storage[key], | |
| clear: () => storage = {}, | |
| }; | |
| }; |
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 'zone.js/dist/long-stack-trace-zone'; | |
| import 'zone.js/dist/proxy.js'; | |
| import 'zone.js/dist/sync-test'; | |
| import 'zone.js/dist/jasmine-patch'; | |
| import 'zone.js/dist/async-test'; | |
| import 'zone.js/dist/fake-async-test'; | |
| import { getTestBed } from '@angular/core/testing'; | |
| import { | |
| BrowserDynamicTestingModule, | |
| platformBrowserDynamicTesting |
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
| const process = require('ts-jest/preprocessor.js').process; | |
| const TEMPLATE_URL_REGEX = /templateUrl:\s*('|")(\.\/){0,}(.*)('|")/g; | |
| const STYLE_URLS_REGEX = /style(Url)?s:\s*\[\s*(require\()?((?:'|").*\s*(?:'|")\)?).*\s*.*\]/g; | |
| const ESCAPE_TEMPLATE_REGEX = /(\${|\`)/g; | |
| module.exports.process = function (src, path, config, transformOptions) { | |
| if (path.endsWith('.html')) { | |
| console.log('preprocessing ' + path); | |
| src = src.replace(ESCAPE_TEMPLATE_REGEX, '\\$1'); |
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, Input, Output, EventEmitter, Renderer} from '@angular/core'; | |
| @Component({ | |
| selector: 'csv-downloader', | |
| template: ` | |
| <button class='btn btn-info' (click)="build()">{{downloaderName}}</button> | |
| ` | |
| }) | |
| export class CsvDownloader { | |
| @Input() downloaderName: string = 'Download CSV'; | |
| @Input() headers: string[] = []; |