Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pluginify tests #709

Merged
merged 5 commits into from Jan 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -8,4 +8,5 @@ standalone*
docs*
*.DS_Store
.idea
bower_components/
bower_components/
test/pluginified/latest.js
30 changes: 29 additions & 1 deletion Gruntfile.js
Expand Up @@ -336,6 +336,34 @@ module.exports = function (grunt) {

},

pluginifyTests: {
options: {
builder: builderJSON,
steal: {
map: {
'*': {
'jquery/jquery.js' : 'lib/jquery/jquery.js',
'can/': ''
}
},
shim: {
'jquery': {
'exports': 'jQuery'
}
}
},
shim: {
'jquery/jquery.js': 'jQuery'
}
},
latest: {
options: { to: 'test/pluginified/latest.js' }
},
legacy: {
options: { to: 'test/pluginified/<%= pkg.version %>.js' }
}
},
publish: {}
});

grunt.loadNpmTasks('grunt-contrib-connect');
Expand All @@ -353,7 +381,7 @@ module.exports = function (grunt) {

grunt.registerTask('quality', [ 'jsbeautifier', 'jshint']);
grunt.registerTask('build', ['clean:build', 'builder', 'amdify', 'stealify', 'uglify', 'string-replace:version']);
grunt.registerTask('test', ['jshint', 'connect', 'build', 'testify', 'qunit']);
grunt.registerTask('test', ['jshint', 'connect', 'build', 'testify', 'pluginifyTests:latest', 'qunit']);
grunt.registerTask('default', ['build']);

};
4 changes: 2 additions & 2 deletions builder.json
Expand Up @@ -139,13 +139,13 @@
"name": "can.Control.plugin",
"type": "plugin",
"description": "Registers a jQuery plugin function for Controls",
"configurations": ["jquery"]
"configurations": ["jquery", "jquery-2"]
},
"can/view/modifiers": {
"name": "can.view.modifiers",
"type": "plugin",
"description": "Use jQuery modifiers to render views",
"configurations": ["jquery"]
"configurations": ["jquery", "jquery-2"]
},
"can/util/object": {
"name": "can.Object",
Expand Down
4 changes: 2 additions & 2 deletions component/component_test.js
@@ -1,4 +1,4 @@
(function () {
steal("can/component", function(){
module('can/component', {
setup: function () {
can.remove(can.$('#qunit-test-area>*'));
Expand Down Expand Up @@ -747,4 +747,4 @@
equal(called, false);
});

}());
});
4 changes: 2 additions & 2 deletions component/test.html
Expand Up @@ -20,9 +20,9 @@ <h2 id="qunit-userAgent"></h2>
<script type="text/javascript" src="../bower_components/qunit/qunit/qunit.js"></script>
<script type="text/javascript">
QUnit.config.autostart = false;
steal("can/component").then("can/component/component_test.js", function() {
steal("can/component/component_test.js", function() {
can.dev.logLevel = 3; QUnit.start();
});
</script>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions compute/compute_test.js
@@ -1,4 +1,4 @@
(function () {
steal("can/compute", "can/test", function() {
module('can/compute');
test('single value compute', function () {
var num = can.compute(1);
Expand Down Expand Up @@ -101,4 +101,4 @@
cloned('-');
equal(cloned(), '.-');
});
}());
});
5 changes: 2 additions & 3 deletions compute/test.html
Expand Up @@ -17,10 +17,9 @@ <h2 id="qunit-userAgent"></h2>
<script type="text/javascript" src="../bower_components/qunit/qunit/qunit.js"></script>
<script type="text/javascript">
QUnit.config.autostart = false;
steal("can/compute")
.then("can/test", "can/compute/compute_test.js", function() {
steal("can/compute/compute_test.js", function() {
can.dev.logLevel = 3; QUnit.start();
});
</script>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions construct/construct_test.js
@@ -1,4 +1,4 @@
(function (undefined) {
steal('can/construct', function() {
/* global Foo, Car, Bar */
module('can/construct', {
setup: function () {
Expand Down Expand Up @@ -128,4 +128,4 @@
new Foo()
.dude(true);
});
}());
});
4 changes: 2 additions & 2 deletions construct/proxy/proxy_test.js
@@ -1,4 +1,4 @@
(function () {
steal("can/construct/proxy", "can/control", function() {
/* global Car */
var isSteal = typeof steal !== 'undefined';
module('can/construct/proxy');
Expand Down Expand Up @@ -44,4 +44,4 @@
}
});
}
}());
});
4 changes: 2 additions & 2 deletions construct/proxy/test.html
Expand Up @@ -17,9 +17,9 @@ <h2 id="qunit-userAgent"></h2>
<script type="text/javascript" src="../../bower_components/qunit/qunit/qunit.js"></script>
<script type="text/javascript">
QUnit.config.autostart = false;
steal("can/construct/proxy", "can/control").then("can/construct/proxy/proxy_test.js", function() {
steal("can/construct/proxy/proxy_test.js", function() {
can.dev.logLevel = 3; QUnit.start();
});
</script>
</body>
</html>
</html>
34 changes: 17 additions & 17 deletions construct/super/super_test.js
@@ -1,4 +1,4 @@
(function () {
steal("can/construct/super", function() {
module('can/construct/super');
test('prototype super', function () {
var A = can.Construct({
Expand Down Expand Up @@ -54,21 +54,21 @@
start();
});
/* Not sure I want to fix this yet.
test("Super in derived when parent doesn't have init", function(){
can.Construct("Parent",{
});
test("Super in derived when parent doesn't have init", function(){
can.Construct("Parent",{
});

Parent("Derived",{
init : function(){
this._super();
}
});
Parent("Derived",{
init : function(){
this._super();
}
});

try {
new Derived();
ok(true, "can call super in init safely")
} catch (e) {
ok(false, "Failed to call super in init with error: " + e)
}
})*/
}());
try {
new Derived();
ok(true, "can call super in init safely")
} catch (e) {
ok(false, "Failed to call super in init with error: " + e)
}
})*/
});
4 changes: 2 additions & 2 deletions construct/super/test.html
Expand Up @@ -17,9 +17,9 @@ <h2 id="qunit-userAgent"></h2>
<script type="text/javascript" src="../../bower_components/qunit/qunit/qunit.js"></script>
<script type="text/javascript">
QUnit.config.autostart = false;
steal("can/construct/super").then("can/construct/super/super_test.js", function() {
steal("can/construct/super/super_test.js", function() {
can.dev.logLevel = 3; QUnit.start();
});
</script>
</body>
</html>
</html>
8 changes: 2 additions & 6 deletions construct/test.html
Expand Up @@ -17,13 +17,9 @@ <h2 id="qunit-userAgent"></h2>
<script type="text/javascript" src="../bower_components/qunit/qunit/qunit.js"></script>
<script type="text/javascript">
QUnit.config.autostart = false;
steal(function() {
steal.config({
root: '../'
});
},"can/construct").then("can/construct/construct_test.js", function() {
steal("can/construct/construct_test.js", function() {
can.dev.logLevel = 3; QUnit.start();
});
</script>
</body>
</html>
</html>
18 changes: 9 additions & 9 deletions control/control_test.js
@@ -1,5 +1,5 @@
/* jshint asi:true*/
(function () {
steal("can/control", function () {
/*global WeirdBind*/
module('can/control');
var isOpera = /Opera/.test(navigator.userAgent),
Expand Down Expand Up @@ -230,8 +230,8 @@
}
});
var item1 = bindable({
id: 1
}),
id: 1
}),
item2 = bindable({
id: 2
}),
Expand Down Expand Up @@ -278,11 +278,11 @@
});
test('Multiple calls to destroy', 2, function () {
var Control = can.Control({
destroy: function () {
ok(true);
can.Control.prototype.destroy.call(this);
}
}),
destroy: function () {
ok(true);
can.Control.prototype.destroy.call(this);
}
}),
div = document.createElement('div'),
c = new Control(div);
c.destroy();
Expand All @@ -309,4 +309,4 @@
can.dev.log = oldlog;
});
}
}());
});
4 changes: 4 additions & 0 deletions control/modifier/modifier_test.js
@@ -1,4 +1,8 @@
steal('can/util', 'can/control/modifier', function (can) {
if(!window.jQuery) {
return;
}

module('can/control/modifier');
test('nested selectors', function () {
var paw, tail;
Expand Down
5 changes: 1 addition & 4 deletions control/modifier/test.html
Expand Up @@ -17,10 +17,7 @@ <h2 id="qunit-userAgent"></h2>
<script type="text/javascript" src="../../bower_components/qunit/qunit/qunit.js"></script>
<script type='text/javascript'>
QUnit.config.autostart = false;
steal(
'can/util',
'can/control'
).then('can/control/modifier/modifier_test.js', function(){
steal('can/control/modifier/modifier_test.js', function(){
can.dev.logLevel = 3; QUnit.start();
})
</script>
Expand Down
8 changes: 6 additions & 2 deletions control/plugin/plugin_test.js
@@ -1,4 +1,8 @@
(function () {
steal("can/control/plugin", function() {
if(!window.jQuery) {
return;
}

/* global My */
module('can/control/plugin');
test('pluginName', function () {
Expand Down Expand Up @@ -97,4 +101,4 @@
ok(control, 'Got a control from pluginName');
equal(control.constructor.pluginName, 'otherTest', 'Got correct control');
});
}());
});
4 changes: 2 additions & 2 deletions control/plugin/test.html
Expand Up @@ -17,9 +17,9 @@ <h2 id="qunit-userAgent"></h2>
<script type="text/javascript" src="../../bower_components/qunit/qunit/qunit.js"></script>
<script type="text/javascript">
QUnit.config.autostart = false;
steal("can/control/plugin").then("can/control/plugin/plugin_test.js", function() {
steal("can/control/plugin/plugin_test.js", function() {
can.dev.logLevel = 3; QUnit.start();
});
</script>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions control/route/route_test.js
@@ -1,6 +1,6 @@
/* jshint asi:true*/
/*global Router*/
(function () {
steal("can/control/route", function () {

module("can/control/route", {
setup: function () {
Expand Down Expand Up @@ -120,4 +120,4 @@
stop();
})

})();
});
4 changes: 2 additions & 2 deletions control/route/test.html
Expand Up @@ -17,9 +17,9 @@ <h2 id="qunit-userAgent"></h2>
<script type="text/javascript" src="../../bower_components/qunit/qunit/qunit.js"></script>
<script type="text/javascript">
QUnit.config.autostart = false;
steal("can/control/route", "can/route/pushstate").then("can/test", "can/control/route/route_test.js", function() {
steal("can/control/route/route_test.js", function() {
can.dev.logLevel = 3; QUnit.start();
});
</script>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions control/test.html
Expand Up @@ -17,9 +17,9 @@ <h2 id="qunit-userAgent"></h2>
<script type="text/javascript" src="../bower_components/qunit/qunit/qunit.js"></script>
<script type="text/javascript">
QUnit.config.autostart = false;
steal("can/control").then("can/control/control_test.js", function() {
steal("can/control/control_test.js", function() {
can.dev.logLevel = 3; QUnit.start();
});
</script>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion control/view/test.html
Expand Up @@ -16,7 +16,7 @@ <h2 id="qunit-userAgent"></h2>
<script type="text/javascript">
QUnit.config.autostart = false;
steal("can/control/view").then("can/control/view/test/view_test.js", function() {
can.dev.logLevel = 3; QUnit.start();
can.dev.logLevel = 3; can.dev.logLevel = 3; QUnit.start();
});
</script>
</body>
Expand Down