This repository has been archived by the owner on Feb 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93b2fda
commit 92b835d
Showing
5 changed files
with
346 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,253 @@ | ||
// function.name (all IE) | ||
/*! @source http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie*/ | ||
if (!Object.hasOwnProperty('name')) { | ||
Object.defineProperty(Function.prototype, 'name', { | ||
get: function() { | ||
var matches = this.toString().match(/^\s*function\s*(\S*)\s*\(/); | ||
var name = matches && matches.length > 1 ? matches[1] : ""; | ||
// For better performance only parse once, and then cache the | ||
// result through a new accessor for repeated access. | ||
Object.defineProperty(this, 'name', {value: name}); | ||
return name; | ||
} | ||
}); | ||
} | ||
|
||
// URL polyfill for SystemJS (all IE) | ||
/*! @source https://github.com/ModuleLoader/es6-module-loader/blob/master/src/url-polyfill.js*/ | ||
// from https://gist.github.com/Yaffle/1088850 | ||
(function(global) { | ||
function URLPolyfill(url, baseURL) { | ||
if (typeof url != 'string') { | ||
throw new TypeError('URL must be a string'); | ||
} | ||
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); | ||
if (!m) { | ||
throw new RangeError(); | ||
} | ||
var protocol = m[1] || ""; | ||
var username = m[2] || ""; | ||
var password = m[3] || ""; | ||
var host = m[4] || ""; | ||
var hostname = m[5] || ""; | ||
var port = m[6] || ""; | ||
var pathname = m[7] || ""; | ||
var search = m[8] || ""; | ||
var hash = m[9] || ""; | ||
if (baseURL !== undefined) { | ||
var base = baseURL instanceof URLPolyfill ? baseURL : new URLPolyfill(baseURL); | ||
var flag = protocol === "" && host === "" && username === ""; | ||
if (flag && pathname === "" && search === "") { | ||
search = base.search; | ||
} | ||
if (flag && pathname.charAt(0) !== "/") { | ||
pathname = (pathname !== "" ? (((base.host !== "" || base.username !== "") && base.pathname === "" ? "/" : "") + base.pathname.slice(0, base.pathname.lastIndexOf("/") + 1) + pathname) : base.pathname); | ||
} | ||
// dot segments removal | ||
var output = []; | ||
pathname.replace(/^(\.\.?(\/|$))+/, "") | ||
.replace(/\/(\.(\/|$))+/g, "/") | ||
.replace(/\/\.\.$/, "/../") | ||
.replace(/\/?[^\/]*/g, function (p) { | ||
if (p === "/..") { | ||
output.pop(); | ||
} else { | ||
output.push(p); | ||
} | ||
}); | ||
pathname = output.join("").replace(/^\//, pathname.charAt(0) === "/" ? "/" : ""); | ||
if (flag) { | ||
port = base.port; | ||
hostname = base.hostname; | ||
host = base.host; | ||
password = base.password; | ||
username = base.username; | ||
} | ||
if (protocol === "") { | ||
protocol = base.protocol; | ||
} | ||
} | ||
|
||
// convert windows file URLs to use / | ||
if (protocol == 'file:') | ||
pathname = pathname.replace(/\\/g, '/'); | ||
|
||
this.origin = protocol + (protocol !== "" || host !== "" ? "//" : "") + host; | ||
this.href = protocol + (protocol !== "" || host !== "" ? "//" : "") + (username !== "" ? username + (password !== "" ? ":" + password : "") + "@" : "") + host + pathname + search + hash; | ||
this.protocol = protocol; | ||
this.username = username; | ||
this.password = password; | ||
this.host = host; | ||
this.hostname = hostname; | ||
this.port = port; | ||
this.pathname = pathname; | ||
this.search = search; | ||
this.hash = hash; | ||
} | ||
global.URLPolyfill = URLPolyfill; | ||
})(typeof self != 'undefined' ? self : global); | ||
|
||
//classList (IE9) | ||
/*! @license please refer to http://unlicense.org/ */ | ||
/*! @author Eli Grey */ | ||
/*! @source https://github.com/eligrey/classList.js */ | ||
;if("document" in self&&!("classList" in document.createElement("_"))){(function(j){"use strict";if(!("Element" in j)){return}var a="classList",f="prototype",m=j.Element[f],b=Object,k=String[f].trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array[f].indexOf||function(q){var p=0,o=this.length;for(;p<o;p++){if(p in this&&this[p]===q){return p}}return -1},n=function(o,p){this.name=o;this.code=DOMException[o];this.message=p},g=function(p,o){if(o===""){throw new n("SYNTAX_ERR","An invalid or illegal string was specified")}if(/\s/.test(o)){throw new n("INVALID_CHARACTER_ERR","String contains an invalid character")}return c.call(p,o)},d=function(s){var r=k.call(s.getAttribute("class")||""),q=r?r.split(/\s+/):[],p=0,o=q.length;for(;p<o;p++){this.push(q[p])}this._updateClassName=function(){s.setAttribute("class",this.toString())}},e=d[f]=[],i=function(){return new d(this)};n[f]=Error[f];e.item=function(o){return this[o]||null};e.contains=function(o){o+="";return g(this,o)!==-1};e.add=function(){var s=arguments,r=0,p=s.length,q,o=false;do{q=s[r]+"";if(g(this,q)===-1){this.push(q);o=true}}while(++r<p);if(o){this._updateClassName()}};e.remove=function(){var t=arguments,s=0,p=t.length,r,o=false;do{r=t[s]+"";var q=g(this,r);if(q!==-1){this.splice(q,1);o=true}}while(++s<p);if(o){this._updateClassName()}};e.toggle=function(p,q){p+="";var o=this.contains(p),r=o?q!==true&&"remove":q!==false&&"add";if(r){this[r](p)}return !o};e.toString=function(){return this.join(" ")};if(b.defineProperty){var l={get:i,enumerable:true,configurable:true};try{b.defineProperty(m,a,l)}catch(h){if(h.number===-2146823252){l.enumerable=false;b.defineProperty(m,a,l)}}}else{if(b[f].__defineGetter__){m.__defineGetter__(a,i)}}}(self))}; | ||
|
||
//console mock (IE9) | ||
if (!window.console) window.console = {}; | ||
if (!window.console.log) window.console.log = function () { }; | ||
if (!window.console.error) window.console.error = function () { }; | ||
if (!window.console.warn) window.console.warn = function () { }; | ||
if (!window.console.assert) window.console.assert = function () { }; | ||
|
||
//RequestAnimationFrame (IE9, Android 4.1, 4.2, 4.3) | ||
/*! @author Paul Irish */ | ||
/*! @source https://gist.github.com/paulirish/1579671 */ | ||
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | ||
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | ||
|
||
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | ||
|
||
// MIT license | ||
|
||
(function() { | ||
var lastTime = 0; | ||
|
||
if (!window.requestAnimationFrame) | ||
window.requestAnimationFrame = function(callback, element) { | ||
var currTime = Date.now(); | ||
var timeToCall = Math.max(0, 16 - (currTime - lastTime)); | ||
var id = window.setTimeout(function() { callback(currTime + timeToCall); }, | ||
timeToCall); | ||
lastTime = currTime + timeToCall; | ||
return id; | ||
}; | ||
|
||
if (!window.cancelAnimationFrame) | ||
window.cancelAnimationFrame = function(id) { | ||
clearTimeout(id); | ||
}; | ||
}()); | ||
|
||
|
||
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */ | ||
|
||
window.matchMedia || (window.matchMedia = function() { | ||
"use strict"; | ||
|
||
// For browsers that support matchMedium api such as IE 9 and webkit | ||
var styleMedia = (window.styleMedia || window.media); | ||
|
||
// For those that don't support matchMedium | ||
if (!styleMedia) { | ||
var style = document.createElement('style'), | ||
script = document.getElementsByTagName('script')[0], | ||
info = null; | ||
|
||
style.type = 'text/css'; | ||
style.id = 'matchmediajs-test'; | ||
|
||
script.parentNode.insertBefore(style, script); | ||
|
||
// 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers | ||
info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle; | ||
|
||
styleMedia = { | ||
matchMedium: function(media) { | ||
var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; | ||
|
||
// 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers | ||
if (style.styleSheet) { | ||
style.styleSheet.cssText = text; | ||
} else { | ||
style.textContent = text; | ||
} | ||
|
||
// Test if media query is true or false | ||
return info.width === '1px'; | ||
} | ||
}; | ||
} | ||
|
||
return function(media) { | ||
return { | ||
matches: styleMedia.matchMedium(media || 'all'), | ||
media: media || 'all' | ||
}; | ||
}; | ||
}()); | ||
/*! matchMedia() polyfill addListener/removeListener extension. Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license */ | ||
(function(){ | ||
// Bail out for browsers that have addListener support | ||
if (window.matchMedia && window.matchMedia('all').addListener) { | ||
return false; | ||
} | ||
|
||
var localMatchMedia = window.matchMedia, | ||
hasMediaQueries = localMatchMedia('only all').matches, | ||
isListening = false, | ||
timeoutID = 0, // setTimeout for debouncing 'handleChange' | ||
queries = [], // Contains each 'mql' and associated 'listeners' if 'addListener' is used | ||
handleChange = function(evt) { | ||
// Debounce | ||
clearTimeout(timeoutID); | ||
|
||
timeoutID = setTimeout(function() { | ||
for (var i = 0, il = queries.length; i < il; i++) { | ||
var mql = queries[i].mql, | ||
listeners = queries[i].listeners || [], | ||
matches = localMatchMedia(mql.media).matches; | ||
|
||
// Update mql.matches value and call listeners | ||
// Fire listeners only if transitioning to or from matched state | ||
if (matches !== mql.matches) { | ||
mql.matches = matches; | ||
|
||
for (var j = 0, jl = listeners.length; j < jl; j++) { | ||
listeners[j].call(window, mql); | ||
} | ||
} | ||
} | ||
}, 30); | ||
}; | ||
|
||
window.matchMedia = function(media) { | ||
var mql = localMatchMedia(media), | ||
listeners = [], | ||
index = 0; | ||
|
||
mql.addListener = function(listener) { | ||
// Changes would not occur to css media type so return now (Affects IE <= 8) | ||
if (!hasMediaQueries) { | ||
return; | ||
} | ||
|
||
// Set up 'resize' listener for browsers that support CSS3 media queries (Not for IE <= 8) | ||
// There should only ever be 1 resize listener running for performance | ||
if (!isListening) { | ||
isListening = true; | ||
window.addEventListener('resize', handleChange, true); | ||
} | ||
|
||
// Push object only if it has not been pushed already | ||
if (index === 0) { | ||
index = queries.push({ | ||
mql : mql, | ||
listeners : listeners | ||
}); | ||
} | ||
|
||
listeners.push(listener); | ||
}; | ||
|
||
mql.removeListener = function(listener) { | ||
for (var i = 0, il = listeners.length; i < il; i++){ | ||
if (listeners[i] === listener){ | ||
listeners.splice(i, 1); | ||
} | ||
} | ||
}; | ||
|
||
return mql; | ||
}; | ||
}()); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Karma configuration | ||
module.exports = function (config) { | ||
require('./karma.conf')(config); | ||
|
||
// Configuration based on: https://github.com/jashkenas/backbone/blob/master/karma.conf-sauce.js | ||
var _ = require('underscore'); | ||
|
||
// Browsers to run on Sauce Labs platforms | ||
var sauceBrowsers = _.reduce([ | ||
['firefox', '41'], | ||
['firefox', '40'], | ||
['firefox', '35'], | ||
['firefox', '30'], | ||
|
||
['chrome', 'beta'], | ||
['chrome', 'dev'], | ||
['chrome', '39'], | ||
['chrome', '26'], | ||
|
||
['microsoftedge', '20.10240', 'Windows 10'], | ||
['internet explorer', '11', 'Windows 10'], | ||
['internet explorer', '10', 'Windows 8'], | ||
['internet explorer', '9', 'Windows 7'], | ||
|
||
['android', '5.1'], | ||
['android', '4.4'] | ||
|
||
], function (memo, platform) { | ||
// internet explorer -> ie | ||
var label = platform[0].split(' '); | ||
if (label.length > 1) { | ||
label = _.invoke(label, 'charAt', 0) | ||
} | ||
label = (label.join("") + '_v' + platform[1]).replace(' ', '_').toUpperCase(); | ||
memo[label] = { | ||
'base': 'SauceLabs', | ||
'browserName': platform[0], | ||
'version': platform[1], | ||
'platform': platform[2] | ||
}; | ||
return memo; | ||
}, {}); | ||
|
||
config.set({ | ||
captureTimeout: 240000, | ||
browserNoActivityTimeout: 120000, | ||
|
||
sauceLabs: { | ||
testName: 'ng2-material', | ||
startConnect: true, | ||
recordVideo: false, | ||
recordScreenshots: false, | ||
options: { | ||
'selenium-version': '2.47.1', | ||
'command-timeout': 600, | ||
'idle-timeout': 600, | ||
'max-duration': 5400 | ||
} | ||
}, | ||
|
||
customLaunchers: sauceBrowsers, | ||
|
||
browsers: Object.keys(sauceBrowsers), | ||
|
||
reporters: ['dots', 'saucelabs', 'coverage'], | ||
|
||
singleRun: true, | ||
|
||
plugins: [ | ||
'karma-*' | ||
] | ||
}); | ||
|
||
if (process.env.TRAVIS) { | ||
config.sauceLabs.build = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'; | ||
config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER; | ||
} | ||
|
||
}; |
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