remove submodules

This commit is contained in:
Nathan Cahill
2018-11-04 14:32:14 -07:00
parent 7c3619675a
commit f1d912e4bd
25 changed files with 8229 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner v2.6.4</title>
<link rel="shortcut icon" type="image/png" href="../lib/jasmine-2.6.4/jasmine_favicon.png">
<link rel="stylesheet" href="../lib/jasmine-2.6.4/jasmine.css">
<script src="../lib/jasmine-2.6.4/jasmine.js"></script>
<script src="../lib/jasmine-2.6.4/jasmine-html.js"></script>
<script src="../lib/jasmine-2.6.4/boot.js"></script>
<script src="polyfills.js"></script>
<script src="../../dist/split.js"></script>
<script src="split.spec.js"></script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,12 @@
{
"test_framework": "jasmine2",
"test_path": "test/ie8/SpecRunner.html",
"browsers": [
{
"browser": "ie",
"browser_version": "8",
"os": "Windows",
"os_version": "7"
}
]
}

View File

@@ -0,0 +1,342 @@
/* Polyfill service v3.18.1
* For detailed credits and licence information see https://github.com/financial-times/polyfill-service.
*
* UA detected: firefox/53.0.0
* Features requested: Array.isArray,Array.prototype.filter,Array.prototype.forEach,Array.prototype.map,Object.keys,getComputedStyle
*
* - Object.defineProperty, License: CC0 (required by "Array.isArray")
* - Array.isArray, License: CC0
* - Array.prototype.filter, License: CC0
* - Array.prototype.forEach, License: CC0
* - Array.prototype.map, License: CC0
* - Object.keys, License: CC0
* - Window, License: CC0 (required by "getComputedStyle")
* - getComputedStyle, License: CC0 */
(function(undefined) {
// Object.defineProperty
(function (nativeDefineProperty) {
var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine';
var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value';
Object.defineProperty = function defineProperty(object, property, descriptor) {
// Where native support exists, assume it
if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) {
return nativeDefineProperty(object, property, descriptor);
}
if (object === null || !(object instanceof Object || typeof object === 'object')) {
throw new TypeError('Object.defineProperty called on non-object');
}
if (!(descriptor instanceof Object)) {
throw new TypeError('Property description must be an object');
}
var propertyString = String(property);
var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor;
var getterType = 'get' in descriptor && typeof descriptor.get;
var setterType = 'set' in descriptor && typeof descriptor.set;
// handle descriptor.get
if (getterType) {
if (getterType !== 'function') {
throw new TypeError('Getter must be a function');
}
if (!supportsAccessors) {
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
}
if (hasValueOrWritable) {
throw new TypeError(ERR_VALUE_ACCESSORS);
}
object.__defineGetter__(propertyString, descriptor.get);
} else {
object[propertyString] = descriptor.value;
}
// handle descriptor.set
if (setterType) {
if (setterType !== 'function') {
throw new TypeError('Setter must be a function');
}
if (!supportsAccessors) {
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
}
if (hasValueOrWritable) {
throw new TypeError(ERR_VALUE_ACCESSORS);
}
object.__defineSetter__(propertyString, descriptor.set);
}
// OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above
if ('value' in descriptor) {
object[propertyString] = descriptor.value;
}
return object;
};
}(Object.defineProperty));
// Array.isArray
(function (toString) {
Object.defineProperty(Array, 'isArray', {
configurable: true,
value: function isArray(object) {
return toString.call(object) === '[object Array]';
},
writable: true
});
}(Object.prototype.toString));
// Array.prototype.filter
Array.prototype.filter = function filter(callback) {
if (this === undefined || this === null) {
throw new TypeError(this + ' is not an object');
}
if (!(callback instanceof Function)) {
throw new TypeError(callback + ' is not a function');
}
var
object = Object(this),
scope = arguments[1],
arraylike = object instanceof String ? object.split('') : object,
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0,
index = -1,
result = [],
element;
while (++index < length) {
element = arraylike[index];
if (index in arraylike && callback.call(scope, element, index, object)) {
result.push(element);
}
}
return result;
};
// Array.prototype.forEach
Array.prototype.forEach = function forEach(callback) {
if (this === undefined || this === null) {
throw new TypeError(this + ' is not an object');
}
if (!(callback instanceof Function)) {
throw new TypeError(callback + ' is not a function');
}
var
object = Object(this),
scope = arguments[1],
arraylike = object instanceof String ? object.split('') : object,
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0,
index = -1;
while (++index < length) {
if (index in arraylike) {
callback.call(scope, arraylike[index], index, object);
}
}
};
// Array.prototype.map
Array.prototype.map = function map(callback) {
if (this === undefined || this === null) {
throw new TypeError(this + ' is not an object');
}
if (!(callback instanceof Function)) {
throw new TypeError(callback + ' is not a function');
}
var
object = Object(this),
scope = arguments[1],
arraylike = object instanceof String ? object.split('') : object,
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0,
index = -1,
result = [];
while (++index < length) {
if (index in arraylike) {
result[index] = callback.call(scope, arraylike[index], index, object);
}
}
return result;
};
// Object.keys
Object.keys = (function() {
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),
dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
],
dontEnumsLength = dontEnums.length;
return function(obj) {
if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {
throw new TypeError('Object.keys called on non-object');
}
var result = [], prop, i;
for (prop in obj) {
if (hasOwnProperty.call(obj, prop)) {
result.push(prop);
}
}
if (hasDontEnumBug) {
for (i = 0; i < dontEnumsLength; i++) {
if (hasOwnProperty.call(obj, dontEnums[i])) {
result.push(dontEnums[i]);
}
}
}
return result;
};
}());
// Window
(function(global) {
if (global.constructor) {
global.Window = global.constructor;
} else {
(global.Window = global.constructor = new Function('return function Window() {}')()).prototype = this;
}
}(this));
// getComputedStyle
(function (global) {
function getComputedStylePixel(element, property, fontSize) {
var
// Internet Explorer sometimes struggles to read currentStyle until the element's document is accessed.
value = element.document && element.currentStyle[property].match(/([\d\.]+)(%|cm|em|in|mm|pc|pt|)/) || [0, 0, ''],
size = value[1],
suffix = value[2],
rootSize;
fontSize = !fontSize ? fontSize : /%|em/.test(suffix) && element.parentElement ? getComputedStylePixel(element.parentElement, 'fontSize', null) : 16;
rootSize = property == 'fontSize' ? fontSize : /width/i.test(property) ? element.clientWidth : element.clientHeight;
return suffix == '%' ? size / 100 * rootSize :
suffix == 'cm' ? size * 0.3937 * 96 :
suffix == 'em' ? size * fontSize :
suffix == 'in' ? size * 96 :
suffix == 'mm' ? size * 0.3937 * 96 / 10 :
suffix == 'pc' ? size * 12 * 96 / 72 :
suffix == 'pt' ? size * 96 / 72 :
size;
}
function setShortStyleProperty(style, property) {
var
borderSuffix = property == 'border' ? 'Width' : '',
t = property + 'Top' + borderSuffix,
r = property + 'Right' + borderSuffix,
b = property + 'Bottom' + borderSuffix,
l = property + 'Left' + borderSuffix;
style[property] = (style[t] == style[r] && style[t] == style[b] && style[t] == style[l] ? [ style[t] ] :
style[t] == style[b] && style[l] == style[r] ? [ style[t], style[r] ] :
style[l] == style[r] ? [ style[t], style[r], style[b] ] :
[ style[t], style[r], style[b], style[l] ]).join(' ');
}
// <CSSStyleDeclaration>
function CSSStyleDeclaration(element) {
var
style = this,
currentStyle = element.currentStyle,
fontSize = getComputedStylePixel(element, 'fontSize'),
unCamelCase = function (match) {
return '-' + match.toLowerCase();
},
property;
for (property in currentStyle) {
Array.prototype.push.call(style, property == 'styleFloat' ? 'float' : property.replace(/[A-Z]/, unCamelCase));
if (property == 'width') {
style[property] = element.offsetWidth + 'px';
} else if (property == 'height') {
style[property] = element.offsetHeight + 'px';
} else if (property == 'styleFloat') {
style.float = currentStyle[property];
} else if (/margin.|padding.|border.+W/.test(property) && style[property] != 'auto') {
style[property] = Math.round(getComputedStylePixel(element, property, fontSize)) + 'px';
} else if (/^outline/.test(property)) {
// errors on checking outline
try {
style[property] = currentStyle[property];
} catch (error) {
style.outlineColor = currentStyle.color;
style.outlineStyle = style.outlineStyle || 'none';
style.outlineWidth = style.outlineWidth || '0px';
style.outline = [style.outlineColor, style.outlineWidth, style.outlineStyle].join(' ');
}
} else {
style[property] = currentStyle[property];
}
}
setShortStyleProperty(style, 'margin');
setShortStyleProperty(style, 'padding');
setShortStyleProperty(style, 'border');
style.fontSize = Math.round(fontSize) + 'px';
}
CSSStyleDeclaration.prototype = {
constructor: CSSStyleDeclaration,
// <CSSStyleDeclaration>.getPropertyPriority
getPropertyPriority: function () {
throw new Error('NotSupportedError: DOM Exception 9');
},
// <CSSStyleDeclaration>.getPropertyValue
getPropertyValue: function (property) {
return this[property.replace(/-\w/g, function (match) {
return match[1].toUpperCase();
})];
},
// <CSSStyleDeclaration>.item
item: function (index) {
return this[index];
},
// <CSSStyleDeclaration>.removeProperty
removeProperty: function () {
throw new Error('NoModificationAllowedError: DOM Exception 7');
},
// <CSSStyleDeclaration>.setProperty
setProperty: function () {
throw new Error('NoModificationAllowedError: DOM Exception 7');
},
// <CSSStyleDeclaration>.getPropertyCSSValue
getPropertyCSSValue: function () {
throw new Error('NotSupportedError: DOM Exception 9');
}
};
// <Global>.getComputedStyle
global.getComputedStyle = function getComputedStyle(element) {
return new CSSStyleDeclaration(element);
};
}(this));
})
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});

View File

@@ -0,0 +1,141 @@
/* eslint-env jasmine */
/* global Split */
/* eslint-disable no-var, func-names, prefer-arrow-callback, object-shorthand, prefer-template */
describe('Split', function() {
beforeEach(function() {
document.body.style.width = '800px'
document.body.style.height = '600px'
this.a = document.createElement('div')
this.b = document.createElement('div')
this.c = document.createElement('div')
this.a.id = 'a'
this.b.id = 'b'
this.c.id = 'c'
document.body.appendChild(this.a)
document.body.appendChild(this.b)
document.body.appendChild(this.c)
})
afterEach(function() {
document.body.removeChild(this.a)
document.body.removeChild(this.b)
document.body.removeChild(this.c)
})
it('splits in two when given two elements', function() {
Split(['#a', '#b'])
expect(this.a.style.width).toBe('50%')
expect(this.b.style.width).toBe('50%')
})
it('splits in three when given three elements', function() {
Split(['#a', '#b', '#c'])
expect(this.a.style.width).toBe('33.33%')
expect(this.b.style.width).toBe('33.33%')
expect(this.c.style.width).toBe('33.33%')
})
it('splits vertically when direction is vertical', function() {
Split(['#a', '#b'], {
direction: 'vertical',
})
expect(this.a.style.height).toBe('50%')
expect(this.b.style.height).toBe('50%')
})
it('splits in percentages when given sizes', function() {
Split(['#a', '#b'], {
sizes: [25, 75],
})
expect(this.a.style.width).toBe('25%')
expect(this.b.style.width).toBe('75%')
})
it('splits in percentages when given sizes', function() {
Split(['#a', '#b'], {
sizes: [25, 75],
})
expect(this.a.style.width).toBe('25%')
expect(this.b.style.width).toBe('75%')
})
it('accounts for gutter size', function() {
Split(['#a', '#b'], {
gutterSize: 20,
})
expect(this.a.style.width).toBe('50%')
expect(this.b.style.width).toBe('50%')
})
it('accounts for gutter size with more than two elements', function() {
Split(['#a', '#b', '#c'], {
gutterSize: 20,
})
expect(this.a.style.width).toBe('33.33%')
expect(this.b.style.width).toBe('33.33%')
expect(this.c.style.width).toBe('33.33%')
})
it('accounts for gutter size when direction is vertical', function() {
Split(['#a', '#b'], {
direction: 'vertical',
gutterSize: 20,
})
expect(this.a.style.height).toBe('50%')
expect(this.b.style.height).toBe('50%')
})
it('accounts for gutter size with more than two elements when direction is vertical', function() {
Split(['#a', '#b', '#c'], {
direction: 'vertical',
gutterSize: 20,
})
expect(this.a.style.height).toBe('33.33%')
expect(this.b.style.height).toBe('33.33%')
expect(this.c.style.height).toBe('33.33%')
})
it('set size directly when given css values', function() {
Split(['#a', '#b'], {
sizes: ['150px', '640px'],
})
expect(this.a.style.width).toBe('150px')
expect(this.b.style.width).toBe('640px')
})
it('adjusts sizes using setSizes', function() {
var split = Split(['#a', '#b'])
split.setSizes([70, 30])
expect(this.a.style.width).toBe('70%')
expect(this.b.style.width).toBe('30%')
})
it('sets element styles using the elementStyle function', function() {
Split(['#a', '#b'], {
elementStyle: function(dimension, size) {
return {
width: size + '%',
}
},
})
expect(this.a.style.width).toBe('50%')
expect(this.b.style.width).toBe('50%')
})
})