Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Updates to match ember-cli-qunit 0.2.0 and 0.3.0 changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Jan 28, 2015
1 parent 68b6b7d commit ebfd485
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 25 deletions.
21 changes: 0 additions & 21 deletions blueprints/ember-cli-mocha/files/tests/test-helper.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
/* globals require, mocha */
import resolver from './helpers/resolver';
import { setResolver } from 'ember-mocha';

setResolver(resolver);

document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>');

$(document).ready(function(){
// Rename elements from qunit -> mocha
$('#qunit').attr('id', 'mocha');
$('#qunit-fixture').attr('id', 'mocha-fixture');

// Declare `expect` as a global here instead of as a var in individual tests.
// This avoids jshint warnings re: `Redefinition of 'expect'`.
window.expect = chai.expect;

var TestLoader = require('ember-cli/test-loader')['default'];
TestLoader.prototype.shouldLoadModule = function(moduleName) {
return moduleName.match(/[-_]test$/) || moduleName.match(/\.jshint$/);
};
TestLoader.load();

mocha.run();
});
2 changes: 1 addition & 1 deletion blueprints/ember-cli-mocha/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
return addonContext.addBowerPackageToProject('ember-cli/ember-cli-test-loader', '0.1.0');
})
.then(function() {
return addonContext.addBowerPackageToProject('stefanpenner/ember-cli-shims', '0.0.3');
return addonContext.addBowerPackageToProject('ember-cli/ember-cli-shims', '0.0.3');
});
}
};
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ module.exports = {
app.bowerDirectory + '/mocha/mocha.css',
app.bowerDirectory + '/chai/chai.js',
app.bowerDirectory + '/ember-mocha/mocha-setup.js',
app.bowerDirectory + '/ember-mocha-adapter/adapter.js'
app.bowerDirectory + '/ember-mocha-adapter/adapter.js',
'vendor/ember-cli-mocha/test-loader.js'
];

var addonOptions = app.options['ember-cli-mocha'];
if (addonOptions && !addonOptions.disableContainerStyles) {
fileAssets.push('vendor/ember-cli-mocha/test-container-styles.css');
}

app.import(app.bowerDirectory + '/ember-mocha/ember-mocha.amd.js', {
type: 'test',
exports: {
Expand Down
8 changes: 6 additions & 2 deletions templates/test-body.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div id="mocha"></div>
<div id="mocha-fixture"></div>

<div id="ember-testing-container">
<div id="ember-testing"></div>
</div>
14 changes: 14 additions & 0 deletions vendor/ember-cli-mocha/test-container-styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ember-testing-container {
position: absolute;
background: white;
bottom: 0;
right: 0;
width: 640px;
height: 384px;
overflow: auto;
z-index: 9999;
border: 1px solid #ccc;
}
#ember-testing {
zoom: 50%;
}
15 changes: 15 additions & 0 deletions vendor/ember-cli-mocha/test-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* globals jQuery,chai,mocha */

jQuery(document).ready(function() {
// Declare `expect` as a global here instead of as a var in individual tests.
// This avoids jshint warnings re: `Redefinition of 'expect'`.
window.expect = chai.expect;

var TestLoader = require('ember-cli/test-loader')['default'];
TestLoader.prototype.shouldLoadModule = function(moduleName) {
return moduleName.match(/[-_]test$/) || moduleName.match(/\.jshint$/);
};
TestLoader.load();

mocha.run();
});

0 comments on commit ebfd485

Please sign in to comment.