This is an example of using a Collection view with Backbone.
This file contains 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
render: function (el) { | |
var self = this; | |
self.$el.empty(); | |
self.$el.html(PageTemplate); | |
if (!window.quotainjector) { | |
window.quotainjector = window.angular.bootstrap(document, ['QuotaReportView']) | |
window.quotainjector.invoke(function($rootScope) { | |
console.log('invoke self.periodYears',self.periodYears) |
This file contains 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
_.mixin({ | |
'extends': function(child, base, props) { | |
child.prototype = _.create(base.prototype, _.assign({ | |
'_super': base.prototype, | |
'constructor': child | |
}, props)); | |
return child; | |
} | |
}); |
This file contains 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
app.service('appPubSub', function($window) { | |
this.subscribe = function(subject, cb) { | |
$window.addEventListener('message', function(event) { | |
if (typeof(event.data.message) === 'string') { | |
event.data.message = JSON.parse(event.data.message.replace(/\&dquot/g, '"').replace(/\&squot/g, "'")); | |
} | |
return event.data.subject === subject && cb(event.data.message); | |
}); | |
}; |
This file contains 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
// http://buildwebthings.com/create-csv-export-client-side-javascript/ | |
function exportToCsv(filename, rows) { | |
var processRow = function (row) { | |
var finalVal = ''; | |
for (var j = 0; j < row.length; j++) { | |
var innerValue = row[j] === null ? '' : row[j].toString(); | |
if (row[j] instanceof Date) { | |
innerValue = row[j].toLocaleString(); | |
}; |
This file contains 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 JSONstringify( obj ) { | |
var val, results = []; | |
results.push('{') | |
for(var key in obj) { | |
val = obj[key]; | |
results.push('"'+ key + '": ') | |
if (typeof(val) === 'number') { | |
results.push(val) | |
} else |
This file contains 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 _ from 'lodash'; | |
/** | |
* Check to see if a particular SVG tag is supported in the browser. | |
* <code> console.log('foreignObject', canUseSVG('foreignObject')); </code> | |
* @returns Boolean | |
*/ | |
export const canUseSVG = (tagStr) => { | |
if (!_.isEmpty(tagStr)) { | |
const lowerCaseTag = tagStr.toLowerCase(); |
This file contains 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 appendFragment(element, data) { | |
var tagMap = { ul: 'li', table: 'tr', tr: 'td' }; | |
var tag = tagMap[element.tagName] || 'li'; | |
var fragment = document.createDocumentFragment(); | |
data.forEach(function(item) { | |
var li = document.createElement(tag); | |
li.textContent = item; | |
fragment.appendChild(li); |
This file contains 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 Keycloak = require('keycloak-connect'); | |
var fs = require('fs'); | |
var express = require('express') | |
var session = require('express-session'); | |
var https = require('https'); | |
var atob = require('atob'); | |
const path = require('path'); | |
var cors = require('cors'); | |
const HOST = 'my-awesome-sauce-app.com'; |
As the web component specs continue to be developed, there has been little information on how to test them.
In particular the /deep/
combinator has been deprecated in Shadow DOM 1.0. This is particularly painful since
most end-to-end testing frameworks rely on elements being discoverable by XPath or calls to querySelector.
Elements in Shadow DOM are selectable by neither.
Webdriver.io has the standard actions by selectors, but also allows browser executable scripts to return an element
OlderNewer