| Command\Helper | WebDriverIO | Puppeteer | Nightmare | Protractor |
|---|---|---|---|---|
| _addPopupListener | x | |||
| _locate | x | x | x | x |
| _locateCheckable | x | x | x | |
| _locateClickable | x | x | x | |
| _locateFields | x | |||
| _getWindowHandle | x | |||
| _locateFields | x | x |
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
| this.prevScroll = {x:0,y:0,time: (new Date()).getTime()}; | |
| function getScrollSpeed(el) { | |
| let moveX, moveY, speedX, speedY, now = (new Date()).getTime(); | |
| moveX = Math.abs(el.scrollX - (this.prevScroll.x || el.scrollX)); | |
| moveY = Math.abs(el.scrollY - (this.prevScroll.y || el.scrollY)); | |
| speedX = moveX / (now - this.prevScroll.time); | |
| speedY = moveY / (now - this.prevScroll.time); | |
| this.prevScroll = {x: el.scrollX, y: el.scrollY, time:(new Date()).getTime()}; | |
| console.log(el.scrollY, moveY,speedY, this.prevScroll); |
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} from '@angular/core'; | |
| @Component({ | |
| selector: 'app', | |
| template: ` | |
| <h1>ngx-loading test</h1> | |
| <button (click)="show=!show">toggle show/hide blocker</button> | |
| <h3>text</h3> | |
| <ngx-loading [showIf]="show"> |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset='UTF-8'> | |
| <title>Responsive Table</title> | |
| <style> | |
| table.responsive { width: 100%; border-collapse: collapse} | |
| table.responsive tr { border: 1px solid #ccc;} |
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 {Pipe, PipeTransform, Type, Component, Directive, EventEmitter } from '@angular/core'; | |
| /** | |
| * Examples: | |
| * MockPipe('some-pipe'); | |
| * MockPipe('some-pipe', () => 'foo'); | |
| */ | |
| export function MockPipe(name: string, transform?: any): Pipe { | |
| class Mock implements PipeTransform { |
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
| <div class="pages"> | |
| <h2> Virtual List </h2> | |
| <hr/> | |
| <div #pages></div> | |
| <!-- | |
| the following will add <dyn-page></dyn-page> into <div #pages></div> | |
| When it's added, it will be pushed down out of view. | |
| User scrolls down, in view, then it will add dyn-page again |
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
| function simpleEncoding(str, num=10) { | |
| return str.split('').map(c => String.fromCharCode(c.charCodeAt(0)+num)).join(''); | |
| } | |
| var encoded = simpleEncoding('hello world'); // 'rovvy*y|vn' | |
| simpleEncoding(encoded, -10); // 'hello world' |
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
| @Component({ | |
| selector: 'ngui-in-view', | |
| template: ` | |
| <ng-container *ngIf="inView" [ngTemplateOutlet]="template"> | |
| </ng-container> | |
| `, | |
| styles: [':host {display: block;}'] | |
| }) | |
| export class NguiInViewComponent implements OnInit, OnDestroy { | |
| observer: IntersectionObserver; |
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, TestBed } from '@angular/core/testing'; | |
| import { NO_ERRORS_SCHEMA } from '@angular/core'; | |
| // do not import any other than you test. For others, mock it | |
| import { AppComponent } from './app.component'; | |
| import { MockComponent } from '../../test/jest-setup'; | |
| describe('AppComponent', () => { | |
| var fixture, component; |