Skip to content

Commit 13859b2

Browse files
committed
Updates tests
1 parent a2d8adf commit 13859b2

File tree

9 files changed

+2609
-2600
lines changed

9 files changed

+2609
-2600
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test/*.js
2+
test/**/*.js
3+
dist/*.js

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
rules: {
3-
indent: [2, 2, {"SwitchCase": 1}],
3+
indent: [2, 2, {SwitchCase: 1}],
44
quotes: [2, 'single'],
55
'linebreak-style': [2, 'unix'],
66
semi: [2, 'always']
@@ -9,5 +9,6 @@ module.exports = {
99
node: true,
1010
browser: true
1111
},
12+
globals: {Promise: true},
1213
extends: 'eslint:recommended'
1314
};

dist/fragments.js

Lines changed: 2539 additions & 2534 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/fragments.js.map

Lines changed: 37 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/fragments.min.js

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

karma.conf.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = function(config) {
3131
// preprocess matching files before serving them to the browser
3232
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
3333
preprocessors: {
34-
'./test/**/*.js': ['browserify'],
34+
'./test/**/*.js': ['browserify']
3535
},
3636

3737

@@ -70,5 +70,5 @@ module.exports = function(config) {
7070
// Concurrency level
7171
// how many browser should be started simultanous
7272
concurrency: Infinity
73-
})
74-
}
73+
});
74+
};

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@
3333
"postbuild": "npm run compress"
3434
},
3535
"dependencies": {
36-
"chip-utils": "^0.2.2",
37-
"observations-js": "^0.2.42"
36+
"chip-utils": "^0.3.0",
37+
"observations-js": "^0.2.59"
3838
},
3939
"devDependencies": {
40-
"browserify": "^10.2.1",
41-
"chai": "^2.3.0",
42-
"eslint": "^1.10.1",
40+
"browserify": "^14.4.0",
41+
"chai": "^4.1.0",
42+
"eslint": "^4.2.0",
4343
"exorcist": "^0.4.0",
44-
"karma": "^0.13.15",
45-
"karma-browserify": "^4.4.2",
44+
"karma": "^1.7.0",
45+
"karma-browserify": "^5.1.1",
4646
"karma-chai": "^0.1.0",
47-
"karma-chrome-launcher": "^0.2.2",
48-
"karma-mocha": "^0.2.1",
49-
"karma-source-map-support": "^1.1.0",
50-
"mocha": "^2.2.5",
51-
"uglify-js": "^2.4.23",
52-
"watchify": "^3.2.1"
47+
"karma-chrome-launcher": "^2.2.0",
48+
"karma-mocha": "^1.3.0",
49+
"karma-source-map-support": "^1.2.0",
50+
"mocha": "^3.4.2",
51+
"uglify-js": "^3.0.24",
52+
"watchify": "^3.9.0"
5353
}
5454
}

src/element-controller.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,21 @@ ObservableHash.extend(ElementController, {
2424
// Bind/unbind the observers for this hash
2525
if (value) {
2626
this._listeners.forEach(function(item) {
27-
item.targetRef = addListener(this, item.target, item.eventName, item.listener);
27+
item.targetRef = addListener(this, item.target, item.eventName, item.listener, item.capture);
2828
}, this);
2929
} else {
3030
this._listeners.forEach(function(item) {
31-
removeListener(item.targetRef, item.eventName, item.listener);
31+
removeListener(item.targetRef, item.eventName, item.listener, item.capture);
3232
delete item.targetRef;
3333
}, this);
3434
}
3535
},
3636

3737

38-
listen: function(target, eventName, listener, context) {
38+
listen: function(target, eventName, listener, context, capture) {
3939
var element = this instanceof Node ? this : this.element;
4040
if (typeof eventName === 'function') {
41+
capture = context;
4142
context = listener;
4243
listener = eventName;
4344
eventName = target;
@@ -68,14 +69,15 @@ ObservableHash.extend(ElementController, {
6869
target: target,
6970
eventName: eventName,
7071
listener: listener,
72+
capture: capture,
7173
targetRef: null
7274
};
7375

7476
this._listeners.push(listenerData);
7577

7678
if (this.listenersEnabled) {
7779
// If not bound will add on attachment
78-
listenerData.targetRef = addListener(this, target, eventName, listener);
80+
listenerData.targetRef = addListener(this, target, eventName, listener, capture);
7981
}
8082
}
8183
});
@@ -93,16 +95,16 @@ function getTarget(component, target) {
9395
return target;
9496
}
9597

96-
function addListener(component, target, eventName, listener) {
98+
function addListener(component, target, eventName, listener, capture) {
9799
// If it's been moved to another document change targets to the relavent one
98100
if ((target = getTarget(component, target))) {
99-
target.addEventListener(eventName, listener);
101+
target.addEventListener(eventName, listener, capture);
100102
return target;
101103
}
102104
}
103105

104-
function removeListener(target, eventName, listener) {
106+
function removeListener(target, eventName, listener, capture) {
105107
if (target) {
106-
target.removeEventListener(eventName, listener);
108+
target.removeEventListener(eventName, listener, capture);
107109
}
108110
}

src/util/toFragment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ var stringToFragment = function(string) {
7575
};
7676

7777
// If HTML Templates are not available (e.g. in IE) then use an older method to work with certain elements.
78-
if (!document.createElement('template').content instanceof DocumentFragment) {
78+
if (!(document.createElement('template').content instanceof DocumentFragment)) {
7979
stringToFragment = (function() {
8080
var tagExp = /<([\w:-]+)/;
8181

0 commit comments

Comments
 (0)