Skip to content

Commit 945ff71

Browse files
committed
Merge pull request #3 from PolymerElements/dont-mix-mocha-interfaces
Only use interface-approved teardown.
2 parents 5208464 + ccc704b commit 945ff71

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "test-fixture",
3-
"version": "0.0.1",
3+
"version": "0.8.4",
44
"description": "A simple element to fixture DOM for tests.",
55
"dependencies": {
66
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.6.0"
77
},
88
"devDependencies": {
9-
"web-component-tester": "~2.2.6",
9+
"web-component-tester": "*",
1010
"polymer": "polymer/polymer#v0.8.0-rc.7"
1111
}
1212
}

test-fixture-mocha.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111
(function (Mocha) {
1212
function extendInterfaceWithFixture (interfaceName) {
1313
var originalInterface = Mocha.interfaces[interfaceName];
14+
var teardownProperty = interfaceName === 'bdd' ? 'afterEach' : 'teardown';
1415

1516
Mocha.interfaces[interfaceName] = function (suite) {
1617
originalInterface.apply(this, arguments);
1718

1819
suite.on('pre-require', function (context, file, mocha) {
19-
if (!(context.afterEach || context.teardown)) {
20+
if (!(context[teardownProperty])) {
2021
return;
2122
}
2223

2324
context.fixture = function (fixtureId, model) {
24-
(context.afterEach || context.teardown)(function () {
25+
context[teardownProperty](function () {
2526
document
2627
.getElementById(fixtureId)
2728
.restore();

0 commit comments

Comments
 (0)