Skip to content

Instantly share code, notes, and snippets.

@bdirito
bdirito / clientscripts.js
Created January 31, 2019 23:10
protractor's client clientsidescripts
/**
* All scripts to be run on the client via executeAsyncScript or
* executeScript should be put here.
*
* NOTE: These scripts are transmitted over the wire as JavaScript text
* constructed using their toString representation, and *cannot*
* reference external variables.
*
* Some implementations seem to have issues with // comments, so use star-style
* inside scripts. (TODO: add issue number / example implementations
#!/usr/bin/env coffee
fs = require 'fs'
{parseString:parseXml, Builder:XmlBuilder} = require 'xml2js'
directoryExists = (path) ->
try
return fs.statSync(path).isDirectory()
catch e
return false
#!/usr/bin/env coffee
fs = require 'fs'
{parseString:parseXml, Builder:XmlBuilder} = require 'xml2js'
directoryExists = (path) ->
try
return fs.statSync(path).isDirectory()
catch e
return false
#!/usr/bin/env coffee
fs = require 'fs'
{parseString:parseXml, Builder:XmlBuilder} = require 'xml2js'
directoryExists = (path) ->
try
return fs.statSync(path).isDirectory()
catch e
return false
foo = => {
Rx.Scheduler.asap.schedule( () => {
window.bar = 'baz';
});
}
// import { foo } from 'something'
it('should set bar', (done) => {
foo();
foo = => {
Rx.Scheduler.asap.schedule( () => {
window.bar = 'baz';
});
}
// import { foo } from 'something'
it('should set bar', () => {
foo();
-- file: app.module --
// import browser etc
import { XModule } from './x.module'
@NgModule({
imports: [ ..., XModule ]
// entryComponents?
// bootstrap?
// something?
import { Component, Inject, EventEmitter } from '@angular/core'
import { FormsModule, FormBuilder } from '@angular/forms'
export class FormInputComponent
@annotations = [
new Component
selector: 'form-input'
inputs: [ 'placeholder', 'value', 'name']
outputs: [ 'valueChange' ]
template: """
# based on ion-sticky
# this is heavily modified however as ion-sticky does not work with
# collection-repeat. To make this work we make the assumption that
# if an element is removed from the 'top' of the list it does NOT
# cease to be there. (collection-repeat prunes the top as it goes out of
# scroll)
define ['ionic'], ->
angular.module 'bl-ion-sticky', ['ionic']
.directive 'blIonSticky', ($ionicPosition) ->