Comments (2)
I have tried doing that within the test itself but the function adding the class (which is what I wanted to test) gets executed before the html is loaded into qunit-fixture.
the config:
require.config({
baseUrl: "../",
paths: {
'jquery': 'components/bower/jquery/dist/jquery.min',
'test-foo': 'components/app/foo/test-foo',
'foo': 'components/app/foo/foo'
},
shim: {
'QUnit': {
exports: 'QUnit'
}
}
});
require(['test-foo'], function(testfoo) {
testfoo.test();
QUnit.load();
QUnit.start();
});
the module
define(['jquery'], function($) {
'use strict';
var Foo = {
_init: function() {
this._addClass();
},
_addClass: function() {
console.log('adding class testit');
$('.foo').addClass('testit');
},
greet: function() {
return "Hello";
}
};
Foo._init();
return {
greet : Foo.greet
};
});
the test
define(['foo'], function(foo) {
'use strict';
var Test = {
test: function() {
module( "module Foo");
asyncTest("foo class test", function() {
expect(1);
// foo() is executed before load is done :(
$('#qunit-fixture').load('../components/app/foo/foo.html', function(data) {
ok($('.foo').hasClass('testit'), ".foo should have class 'testit'");
QUnit.start();
});
});
}
};
return {
test: Test.test
};
});
from grunt-contrib-qunit.
I see that you already fixed your problem in above referenced issue.
Closing for now, feel free to ask if you have followup question.
from grunt-contrib-qunit.
Related Issues (20)
- Can't find variable test
- grunt-contrib-qunit should support headless chrome HOT 5
- Meaningless error when resources failed to load or there is a script error HOT 1
- qunit grunt fails with phantomjs HOT 2
- Appears to try loading the file from the wrong location HOT 1
- Option 'inject' stopped working in 3.0.0 HOT 3
- puppeteer unable to launch Chrome on Windows HOT 3
- Could not load the specified bridge file HOT 7
- Blocked by CORS policy HOT 5
- Missing tag for 3.1.0 version HOT 1
- Unable to run qunit tests for SAP UI5 applications
- Update repo "About" description HOT 1
- Page timeout no longer works since grunt-contrib-qunit 3.0
- Switching to ESM only HOT 1
- Problem with puppeteer version on Apple M1 chip HOT 3
- Bridge's testEnd event handler is passing too much to sendMessage: JSON errors. HOT 8
- Upgrade puppeteer to the latest?
- Unreadable output for deepEqual() assertions HOT 1
- Seeing "Error: ReferenceError: QUnit is not defined" HOT 8
- Fail to install "Puppeteer" dependency HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-contrib-qunit.