| OLD | NEW |
| (Empty) | |
| 1 /** |
| 2 * @license |
| 3 * Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt |
| 5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt |
| 6 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt |
| 7 * Code distributed by Google as part of the polymer project is also |
| 8 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt |
| 9 */ |
| 10 |
| 11 (function (Mocha) { |
| 12 function extendInterfaceWithFixture (interfaceName) { |
| 13 var originalInterface = Mocha.interfaces[interfaceName]; |
| 14 var teardownProperty = interfaceName === 'bdd' ? 'afterEach' : 'teardown'; |
| 15 |
| 16 Mocha.interfaces[interfaceName] = function (suite) { |
| 17 originalInterface.apply(this, arguments); |
| 18 |
| 19 suite.on('pre-require', function (context, file, mocha) { |
| 20 if (!(context[teardownProperty])) { |
| 21 return; |
| 22 } |
| 23 |
| 24 context.fixture = function (fixtureId, model) { |
| 25 context[teardownProperty](function () { |
| 26 document |
| 27 .getElementById(fixtureId) |
| 28 .restore(); |
| 29 }); |
| 30 |
| 31 return document |
| 32 .getElementById(fixtureId) |
| 33 .create(model); |
| 34 }; |
| 35 }); |
| 36 }; |
| 37 } |
| 38 |
| 39 Object.keys(Mocha.interfaces).forEach(extendInterfaceWithFixture); |
| 40 })(this.Mocha); |
| OLD | NEW |