Permalink
Browse files

Updated AMD tests

  • Loading branch information...
1 parent 41743e7 commit 8b4c1032a81796fba8842eba16f0fdcff9c3ac8c Kevin Malakoff committed Mar 30, 2013
View
@@ -50,6 +50,6 @@ module.exports =
# amd tests
'cp -v underscore vendor/test/underscore.js'
'cp -v backbone vendor/test/backbone.js'
- 'cp knockout/build/output/knockout-latest.debug.js vendor/test/knockout-2.2.1.js'
+ 'cp knockout/build/output/knockout-latest.debug.js vendor/knockout-2.2.1.js'
'cp -v knockback/knockback-core.js vendor/test/knockback-core.js'
]
View
@@ -51,6 +51,8 @@ kbi = this.kbi = typeof exports !== 'undefined' ? exports : {};
this.kbi.VERSION = '0.1.6';
+this.kb = kb;
+
kbi.TemplateSource = (function() {
function TemplateSource(template_generator, binding_context) {
this.template_generator = template_generator;

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -25,7 +25,7 @@
"dependencies": {
"backbone": ">=1.0.0",
"knockout": "2.2.1",
- "backbone-relational": ">=0.8.0",
+ "backbone-relational": ">=0.8.0plus",
"backbone-modelref": ">=0.1.5",
"knockback": ">=0.17.0pre",
"lodash": ">=0.6.1"
@@ -51,6 +51,8 @@ kbi = this.kbi = typeof exports !== 'undefined' ? exports : {};
this.kbi.VERSION = '0.1.6';
+this.kb = kb;
+
kbi.TemplateSource = (function() {
function TemplateSource(template_generator, binding_context) {
this.template_generator = template_generator;

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -51,6 +51,8 @@ kbi = this.kbi = typeof exports !== 'undefined' ? exports : {};
this.kbi.VERSION = '0.1.6';
+this.kb = kb;
+
kbi.TemplateSource = (function() {
function TemplateSource(template_generator, binding_context) {
this.template_generator = template_generator;

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -17,3 +17,6 @@ kb = if not @kb and (typeof(require) isnt 'undefined') then require('knockback')
# export or create kbi namespace
kbi = @kbi = if (typeof(exports) != 'undefined') then exports else {}
@kbi.VERSION = '0.1.6'
+
+# export Knockback so it is accessible by the views
+@kb = kb
View
@@ -2,9 +2,9 @@
<html>
<head>
<title>Knockback-Inspector - All Tests</title>
- <link rel="stylesheet" href="vendor/qunit/qunit.css" type="text/css" media="screen" />
- <script type="text/javascript" src="vendor/qunit/jquery.js"></script>
- <script type="text/javascript" src="vendor/qunit/qunit.js"></script>
+ <link rel="stylesheet" href="../vendor/test/qunit/qunit-1.11.0.css" type="text/css" media="screen" />
+ <script type="text/javascript" src="../vendor/test/jquery-1.9.1.js"></script>
+ <script type="text/javascript" src="../vendor/test/qunit/qunit-1.11.0.js"></script>
<style type="text/css">
iframe, body {height: 100%; padding:0; margin: 0;}
iframe {float: left;}
View
@@ -1,37 +1,25 @@
-$(->
- module("knockback-defaults-amd.js")
+try
+ require.config({
+ paths:
+ 'underscore': "../../vendor/test/underscore-1.4.4"
+ 'backbone': "../../vendor/test/backbone-1.0.0"
+ 'backbone-relational': "../../vendor/test/backbone-relational-0.6.0"
+ 'knockout': "../../vendor/test/knockout-2.2.1"
+ 'knockback': "../../vendor/test/knockback-core-0.17.0pre"
+ 'knockback-inspector': "../../knockback-inspector"
+ shim:
+ underscore:
+ exports: '_'
+ backbone:
+ exports: 'Backbone'
+ deps: ['underscore']
+ })
+
+ module_name = 'knockback-defaults'
+ module_name = 'knockback' if (require.toUrl(module_name).split('./..').length is 1)
# library and dependencies
- require(['underscore', 'backbone', 'knockout', 'knockback', 'knockback-inspector'], (_, Backbone, ko, kb, kbi) ->
- _ or= @_
- Backbone or= @Backbone
-
- test("TEST DEPENDENCY MISSING", ->
- ok(!!_); ok(!!Backbone); ok(!!ko); ok(!!kb); ok(!!kbi)
- )
-
- # make kbi global so can be accessed by templates
- window.kbi = kbi
-
- # set the template engine so Knockout can find 'kbi_model_node' and 'kbi_collection_node' templates
- ko.setTemplateEngine(new kbi.TemplateEngine())
-
- test("Backbone.Model", ->
- html = """
- <ul id='model' data-bind="template: {name: 'kbi_model_node', data: kbi.nvm('root', true, $data)}"></ul>
- """
-
- your_model = new Backbone.Model({name: 'Hello', place: 'World!'})
- ko.applyBindings(kb.viewModel(your_model), $(html)[0])
- )
-
- test("Backbone.Collection", ->
- html = """
- <ul id='collection' data-bind="template: {name: 'kbi_collection_node', data: kbi.nvm('root', true, $data)}"></ul>
- """
-
- your_collection = new Backbone.Collection([{name: 'Hello', place: 'World!'}, {name: 'Goodbye', place: 'Samsara!'}])
- ko.applyBindings(kb.collectionObservable(your_collection, {view_model: kb.ViewModel}), $(html)[0]);
- )
- )
-)
+ require ['underscore', 'backbone', 'knockout', 'knockback', 'knockback-inspector', 'qunit_test_runner'], (_, Backbone, ko, kb, kbi, runner) ->
+ window._ = window.Backbone = window.ko = window.kbi = null # force each test to require dependencies synchronously
+ # window.kb = null # force each test to require dependencies synchronously
+ require ['./build/test'], -> runner.start()
@@ -3,24 +3,13 @@
<head>
<title>Knockback-Inspector Test Suite (AMD)</title>
- <script src="../../vendor/test/require.js"></script>
- <script type="text/javascript">
- require.config({
- paths: {
- 'underscore': "../../vendor/test/underscore-1.4.4",
- 'backbone': "../../vendor/test/backbone-1.0.0",
- 'backbone-relational': "../../vendor/test/backbone-relational-0.6.0",
- 'knockout': "../../vendor/test/knockout-2.2.1",
- 'knockback': "../../vendor/test/knockback-core-0.17.0pre",
- 'knockback-inspector': "../../knockback-inspector"
- }
- });
- </script>
-
<!-- TESTS -->
- <link rel="stylesheet" href="../../vendor/test/qunit/qunit.css" type="text/css" media="screen" />
+ <script src="../../vendor/test/require.js"></script>
+ <link rel="stylesheet" href="../../vendor/test/qunit/qunit-1.11.0.css" type="text/css" media="screen" />
<script type="text/javascript" src="../../vendor/test/jquery-1.9.1.js"></script>
- <script type="text/javascript" src="../../vendor/test/qunit/qunit.js"></script>
+ <script type="text/javascript" src="../../vendor/test/qunit/qunit-1.11.0.js"></script>
+ <script type="text/javascript" src="../../vendor/test/qunit/qunit_test_runner.js"></script>
+
<script type="text/javascript" src="build/test-amd.js"></script>
</head>
<body>
@@ -30,6 +19,5 @@ <h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</div>
- <script type="text/javascript">QUnit.done = function(failures, total) {if (!total) { $('#qunit-banner').removeClass('qunit-pass').addClass('qunit-fail'); throw 'Warning: no tests run'}}</script>
</body>
</html>
View
@@ -1,37 +1,37 @@
-$(->
- module("knockback-inspector")
-
- # import Underscore (or Lo-Dash with precedence), Backbone, Knockout, and Knockback
- Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
- ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
- kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
- kbi = if not window.kbi and (typeof(require) != 'undefined') then require('knockback-inspector') else window.kbi
-
- test("TEST DEPENDENCY MISSING", ->
- ok(!!Backbone); ok(!!ko); ok(!!kb); ok(!!kbi)
- )
-
- # make kbi global so can be accessed by templates
- window.kbi = kbi
-
- # set the template engine so Knockout can find 'kbi_model_node' and 'kbi_collection_node' templates
- ko.setTemplateEngine(new kbi.TemplateEngine())
-
- test("Backbone.Model", ->
- html = """
- <ul id='model' data-bind="template: {name: 'kbi_model_node', data: kbi.nvm('root', true, $data)}"></ul>
- """
-
- your_model = new Backbone.Model({name: 'Hello', place: 'World!'})
- ko.applyBindings(kb.viewModel(your_model), $(html)[0])
- )
-
- test("Backbone.Collection", ->
- html = """
- <ul id='collection' data-bind="template: {name: 'kbi_collection_node', data: kbi.nvm('root', true, $data)}"></ul>
- """
-
- your_collection = new Backbone.Collection([{name: 'Hello', place: 'World!'}, {name: 'Goodbye', place: 'Samsara!'}])
- ko.applyBindings(kb.collectionObservable(your_collection, {view_model: kb.ViewModel}), $(html)[0]);
- )
+module("knockback-inspector")
+
+# import Underscore (or Lo-Dash with precedence), Backbone, Knockout, and Knockback
+Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
+ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
+kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
+kbi = if not window.kbi and (typeof(require) != 'undefined') then require('knockback-inspector') else window.kbi
+
+test("TEST DEPENDENCY MISSING", ->
+ ok(!!Backbone); ok(!!ko); ok(!!kb); ok(!!kbi)
+)
+
+# make kbi global so can be accessed by templates
+window.kbi = kbi
+
+# set the template engine so Knockout can find 'kbi_model_node' and 'kbi_collection_node' templates
+ko.setTemplateEngine(new kbi.TemplateEngine())
+
+test("Backbone.Model", ->
+ html = """
+ <ul id='model' data-bind="template: {name: 'kbi_model_node', data: kbi.nvm('root', true, $data)}"></ul>
+ """
+
+ your_model = new Backbone.Model({name: 'Hello', place: 'World!'})
+ ko.applyBindings(kb.viewModel(your_model), $(html)[0])
+ ok(true)
+)
+
+test("Backbone.Collection", ->
+ html = """
+ <ul id='collection' data-bind="template: {name: 'kbi_collection_node', data: kbi.nvm('root', true, $data)}"></ul>
+ """
+
+ your_collection = new Backbone.Collection([{name: 'Hello', place: 'World!'}, {name: 'Goodbye', place: 'Samsara!'}])
+ ko.applyBindings(kb.collectionObservable(your_collection, {view_model: kb.ViewModel}), $(html)[0]);
+ ok(true)
)
View
@@ -4,15 +4,17 @@
<title>Knockback-Inspector Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
<script type="text/javascript" src="../../vendor/knockback-core-stack-0.17.0pre.js"></script>
- <script type="text/javascript" src="../../vendor/backbone-relational-0.8.0.js"></script>
+ <script type="text/javascript" src="../../vendor/backbone-relational-0.8.0plus.js"></script>
<!-- LIBRARY -->
<script type="text/javascript" src="../../knockback-inspector.js"></script>
<!-- TESTS -->
- <link rel="stylesheet" href="../../vendor/test/qunit/qunit.css" type="text/css" media="screen" />
+ <link rel="stylesheet" href="../../vendor/test/qunit/qunit-1.11.0.css" type="text/css" media="screen" />
<script type="text/javascript" src="../../vendor/test/jquery-1.9.1.js"></script>
- <script type="text/javascript" src="../../vendor/test/qunit/qunit.js"></script>
+ <script type="text/javascript" src="../../vendor/test/qunit/qunit-1.11.0.js"></script>
+ <script type="text/javascript" src="../../vendor/test/qunit/qunit_test_runner.js"></script>
+
<script type="text/javascript" src="build/test.js"></script>
</head>
@@ -23,6 +25,5 @@ <h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</div>
- <script type="text/javascript">QUnit.done = function(failures, total) {if (!total) { $('#qunit-banner').removeClass('qunit-pass').addClass('qunit-fail'); throw 'Warning: no tests run'}}</script>
</body>
</html>
View
@@ -4,15 +4,17 @@
<title>Knockback-Inspector Test Suite (Production)</title>
<!-- LIBRARY DEPENDENCIES -->
<script type="text/javascript" src='../../vendor/knockback-core-stack-0.17.0pre.js'></script>
- <script type="text/javascript" src="../../vendor/backbone-relational-0.8.0.js"></script>
+ <script type="text/javascript" src="../../vendor/backbone-relational-0.8.0plus.js"></script>
<!-- LIBRARY -->
<script type="text/javascript" src="../../knockback-inspector.min.js"></script>
<!-- TESTS -->
- <link rel="stylesheet" href="../../vendor/test/qunit/qunit.css" type="text/css" media="screen" />
+ <link rel="stylesheet" href="../../vendor/test/qunit/qunit-1.11.0.css" type="text/css" media="screen" />
<script type="text/javascript" src="../../vendor/test/jquery-1.9.1.js"></script>
- <script type="text/javascript" src="../../vendor/test/qunit/qunit.js"></script>
+ <script type="text/javascript" src="../../vendor/test/qunit/qunit-1.11.0.js"></script>
+ <script type="text/javascript" src="../../vendor/test/qunit/qunit_test_runner.js"></script>
+
<script type="text/javascript" src="build/test.js"></script>
</head>
<body>
@@ -22,6 +24,5 @@ <h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</div>
- <script type="text/javascript">QUnit.done = function(failures, total) {if (!total) { $('#qunit-banner').removeClass('qunit-pass').addClass('qunit-fail'); throw 'Warning: no tests run'}}</script>
</body>
</html>
@@ -5,9 +5,9 @@
<title class='inspector_title' data-bind="text: title"></title>
<!-- DEPENDENCIES -->
- <script type="text/javascript" src='../../vendor/jquery-1.8.0.js'></script>
+ <script type="text/javascript" src='../../vendor/jquery-1.9.1.js'></script>
<script type="text/javascript" src='../../vendor/knockback-core-stack-0.17.0pre.js'></script>
- <script type="text/javascript" src="../../vendor/backbone-relational-0.8.0.js"></script>
+ <script type="text/javascript" src="../../vendor/backbone-relational-0.8.0plus.js"></script>
<!-- KNOCKBACK-INSPECTOR LIBRARY -->
<script src='../../knockback-inspector.js'></script>
@@ -1,6 +1,6 @@
module.exports =
'test/lodash/build/bundle-lodash.js':
- lodash: 'vendor/optional/lodash-1.1.0.js'
+ lodash: 'vendor/optional/lodash-1.1.1.js'
backbone: 'backbone'
'backbone-relational': 'backbone-relational'
knockout: 'knockout'
View
@@ -2,12 +2,14 @@
<html>
<head>
<title>Knockback-Inspector Test Suite Lo-Dash</title>
- <link rel="stylesheet" href="../../vendor/test/qunit/qunit.css" type="text/css" media="screen" />
+ <link rel="stylesheet" href="../../vendor/test/qunit/qunit-1.11.0.css" type="text/css" media="screen" />
<script type="text/javascript" src="build/bundle-lodash.js"></script>
<script type="text/javascript" src="../../vendor/test/jquery-1.9.1.js"></script>
- <script type="text/javascript" src="../../vendor/test/qunit/qunit.js"></script>
+ <script type="text/javascript" src="../../vendor/test/qunit/qunit-1.11.0.js"></script>
+ <script type="text/javascript" src="../../vendor/test/qunit/qunit_test_runner.js"></script>
+
<script type="text/javascript" src="../core/build/test.js"></script>
</head>
<body>
@@ -17,6 +19,5 @@ <h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</div>
- <script type="text/javascript">QUnit.done = function(failures, total) {if (!total) { $('#qunit-banner').removeClass('qunit-pass').addClass('qunit-fail'); throw 'Warning: no tests run'}}</script>
</body>
</html>
View
@@ -2,12 +2,13 @@
<html>
<head>
<title>Knockback-Inspector Test Suite Packaging</title>
- <link rel="stylesheet" href="../../vendor/test/qunit/qunit.css" type="text/css" media="screen" />
-
<script type="text/javascript" src="build/bundle.js"></script>
+ <link rel="stylesheet" href="../../vendor/test/qunit/qunit-1.11.0.css" type="text/css" media="screen" />
<script type="text/javascript" src="../../vendor/test/jquery-1.9.1.js"></script>
- <script type="text/javascript" src="../../vendor/test/qunit/qunit.js"></script>
+ <script type="text/javascript" src="../../vendor/test/qunit/qunit-1.11.0.js"></script>
+ <script type="text/javascript" src="../../vendor/test/qunit/qunit_test_runner.js"></script>
+
<script type="text/javascript" src="../core/build/test.js"></script>
</head>
<body>
@@ -17,6 +18,5 @@ <h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</div>
- <script type="text/javascript">QUnit.done = function(failures, total) {if (!total) { $('#qunit-banner').removeClass('qunit-pass').addClass('qunit-fail'); throw 'Warning: no tests run'}}</script>
</body>
</html>
View
@@ -1,11 +0,0 @@
-var testsDoneCallback = function(details) {
- // TODO: implement for requirejs
- if (typeof(require) != 'undefined') return;
-
- if (!details.total) {
- $('#qunit-banner').removeClass('qunit-pass').addClass('qunit-fail');
- throw new Error('Warning: no tests run');
- }
-};
-
-QUnit.done(testsDoneCallback);
@@ -5,9 +5,9 @@
<title class='inspector_title' data-bind="text: title"></title>
<!-- DEPENDENCIES -->
- <script type="text/javascript" src='../../../vendor/jquery-1.8.0.js'></script>
+ <script type="text/javascript" src='../../../vendor/jquery-1.9.1.js'></script>
<script type="text/javascript" src='../../../vendor/knockback-core-stack-0.17.0pre.js'></script>
- <script type="text/javascript" src="../../../vendor/backbone-relational-0.8.0.js"></script>
+ <script type="text/javascript" src="../../../vendor/backbone-relational-0.8.0plus.js"></script>
<!-- KNOCKBACK-INSPECTOR LIBRARY -->
<script src='javascripts/lib/kbi_core.js'></script>
Oops, something went wrong.

0 comments on commit 8b4c103

Please sign in to comment.