Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: appengine/config_service/ui/bower_components/test-fixture/test-fixture-mocha.js

Issue 2923973003: Added base template for config ui. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698