Permalink
Browse files

Add AMD tests

  • Loading branch information...
1 parent 933223a commit cc5ccfa7879b5b912c2b61aa54291a294401f90d Kevin Malakoff committed Sep 14, 2012
View
@@ -118,4 +118,10 @@ module.exports =
'cp -v knockout-client/knockout.debug.js examples/vendor/knockout.js'
'cp -v backbone examples/vendor/backbone/backbone.js'
'cp -v underscore examples/vendor/backbone/underscore.js'
+
+ # amd tests
+ 'cp -v underscore test/vendor/underscore.js'
+ 'cp -v backbone test/vendor/backbone.js'
+ 'cp -v knockout-client/knockout.debug.js test/vendor/knockout.js'
+ 'cp -v knockback/knockback-core.js test/vendor/knockback-core.js'
]
View
@@ -2,6 +2,7 @@ Please refer to the following release notes when upgrading your version of Knock
## 0.1.1
+* added AMD loader to all components.
* updated kb.loadUrl and added kb.loadUrlFn so they can be called directly from an HTML View
* renamed knockback-sample-transitions to knockback-sample-transitions-jquery
@@ -1,3 +1,9 @@
+/*
+ knockback-core-stack.js 0.16.5
+ (c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
+ License: MIT (http://www.opensource.org/licenses/mit-license.php)
+ Dependencies: Knockout.js, Backbone.js, and Underscore.js.
+*/
// Underscore.js 1.3.3
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
@@ -5932,14 +5938,11 @@ ko.exportSymbol('nativeTemplateEngine', ko.nativeTemplateEngine);
});
})(window,document,navigator);
/*
- knockback.js 0.16.5
- (c) 2011, 2012 Kevin Malakoff.
- Knockback.js is freely distributable under the MIT license.
- See the following for full license details:
- https://github.com/kmalakoff/knockback/blob/master/LICENSE
+ knockback-core.js 0.16.5
+ (c) 2011, 2012 Kevin Malakoff - http://kmalakoff.github.com/knockback/
+ License: MIT (http://www.opensource.org/licenses/mit-license.php)
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
*/
-
(function() {
return (function(factory) {
// AMD
@@ -0,0 +1,23 @@
+$(document).ready( ->
+ module("knockback-page-navigators-panes-amd.js")
+
+ # Knockback and depdenencies
+ require(['underscore', 'backbone', 'knockout', 'knockback', 'knockback-page-navigator-panes'], (_, Backbone, ko, kb) ->
+ _ or (_ = kb._)
+ Backbone or (Backbone = kb.Backbone)
+
+ test("TEST DEPENDENCY MISSING", ->
+ ok(!!_, '_'); ok(!!Backbone, 'Backbone'); ok(!!ko, 'ko'); ok(!!kb, 'kb'); ok(!!kb.PageNavigatorPanes, 'kb.PageNavigatorPanes')
+ )
+
+ test("1. Basic Usage", ->
+ # kb.statistics = new kb.Statistics() # turn on stats
+
+ el = $('<div></div>')[0]
+ page_navigator = new kb.PageNavigatorPanes(el)
+ equal(el, page_navigator.el, "container element")
+
+ # equal(kb.statistics.registeredStatsString('all released'), 'all released', "Cleanup: stats"); kb.statistics = null
+ )
+ )
+)
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
+<head>
+ <title>Knockback.PageNavigatorPanes Test Suite (AMD)</title>
+ <script src="../vendor/require.js"></script>
+ <script type="text/javascript">
+ require.config({
+ paths: {
+ 'underscore': "../vendor/underscore-1.3.3",
+ 'backbone': "../vendor/backbone-0.9.2",
+ 'knockout': "../vendor/knockout-2.1.0",
+ 'knockback': "../vendor/knockback-core-0.16.5",
+ 'knockback-page-navigator-panes': "../../knockback-page-navigator-panes",
+ }
+ });
+ </script>
+
+ <!-- TESTS -->
+ <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>
+ <script type="text/javascript" src="../vendor/qunit/jslitmus.js"></script>
+ <script type="text/javascript" src="build/test-amd.js"></script>
+</head>
+<body>
+ <div>
+ <h1 id="qunit-header">Knockback.PageNavigatorPanes Test Suite (AMD)</h1>
+ <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>
@@ -10,19 +10,15 @@ $(document).ready( ->
require('knockback-page-navigator-panes') if (typeof(require) isnt 'undefined')
test("TEST DEPENDENCY MISSING", ->
- ok(!!ko, 'ko')
- ok(!!_, '_')
- ok(!!Backbone, 'Backbone')
- ok(!!kb, 'kb')
- ok(!!kb, 'kb')
- ok(!!kb.PageNavigatorPanes, 'kb.PageNavigatorPanes')
+ ok(!!_, '_'); ok(!!Backbone, 'Backbone'); ok(!!ko, 'ko'); ok(!!kb, 'kb'); ok(!!kb.PageNavigatorPanes, 'kb.PageNavigatorPanes')
)
test("1. Basic Usage", ->
# kb.statistics = new kb.Statistics() # turn on stats
el = $('<div></div>')[0]
page_navigator = new kb.PageNavigatorPanes(el)
+ equal(el, page_navigator.el, "container element")
# equal(kb.statistics.registeredStatsString('all released'), 'all released', "Cleanup: stats"); kb.statistics = null
)
@@ -0,0 +1,23 @@
+$(document).ready( ->
+ module("knockback-page-navigators-simple-amd.js")
+
+ # Knockback and depdenencies
+ require(['underscore', 'backbone', 'knockout', 'knockback', 'knockback-page-navigator-simple'], (_, Backbone, ko, kb) ->
+ _ or (_ = kb._)
+ Backbone or (Backbone = kb.Backbone)
+
+ test("TEST DEPENDENCY MISSING", ->
+ ok(!!_, '_'); ok(!!Backbone, 'Backbone'); ok(!!ko, 'ko'); ok(!!kb, 'kb'); ok(!!kb.PageNavigatorSimple, 'kb.PageNavigatorSimple')
+ )
+
+ test("1. Basic Usage", ->
+ # kb.statistics = new kb.Statistics() # turn on stats
+
+ el = $('<div></div>')[0]
+ page_navigator = new kb.PageNavigatorSimple(el)
+ equal(el, page_navigator.el, "container element")
+
+ # equal(kb.statistics.registeredStatsString('all released'), 'all released', "Cleanup: stats"); kb.statistics = null
+ )
+ )
+)
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
+<head>
+ <title>Knockback.PageNavigatorSimple Test Suite (AMD)</title>
+ <script src="../vendor/require.js"></script>
+ <script type="text/javascript">
+ require.config({
+ paths: {
+ 'underscore': "../vendor/underscore-1.3.3",
+ 'backbone': "../vendor/backbone-0.9.2",
+ 'knockout': "../vendor/knockout-2.1.0",
+ 'knockback': "../vendor/knockback-core-0.16.5",
+ 'knockback-page-navigator-simple': "../../knockback-page-navigator-simple",
+ }
+ });
+ </script>
+
+ <!-- TESTS -->
+ <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>
+ <script type="text/javascript" src="../vendor/qunit/jslitmus.js"></script>
+ <script type="text/javascript" src="build/test-amd.js"></script>
+</head>
+<body>
+ <div>
+ <h1 id="qunit-header">Knockback.PageNavigatorSimple Test Suite (AMD)</h1>
+ <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>
@@ -10,19 +10,15 @@ $(document).ready( ->
require('knockback-page-navigator-simple') if (typeof(require) isnt 'undefined')
test("TEST DEPENDENCY MISSING", ->
- ok(!!ko, 'ko')
- ok(!!_, '_')
- ok(!!Backbone, 'Backbone')
- ok(!!kb, 'kb')
- ok(!!kb, 'kb')
- ok(!!kb.PageNavigatorSimple, 'kb.PageNavigatorSimple')
+ ok(!!_, '_'); ok(!!Backbone, 'Backbone'); ok(!!ko, 'ko'); ok(!!kb, 'kb'); ok(!!kb.PageNavigatorSimple, 'kb.PageNavigatorSimple')
)
test("1. Basic Usage", ->
# kb.statistics = new kb.Statistics() # turn on stats
el = $('<div></div>')[0]
page_navigator = new kb.PageNavigatorSimple(el)
+ equal(el, page_navigator.el, "container element")
# equal(kb.statistics.registeredStatsString('all released'), 'all released', "Cleanup: stats"); kb.statistics = null
)
@@ -0,0 +1,23 @@
+$(document).ready( ->
+ module("knockback-page-navigators-simple-amd.js")
+
+ # Knockback and depdenencies
+ require(['underscore', 'backbone', 'knockout', 'knockback', 'knockback-pane-navigator'], (_, Backbone, ko, kb) ->
+ _ or (_ = kb._)
+ Backbone or (Backbone = kb.Backbone)
+
+ test("TEST DEPENDENCY MISSING", ->
+ ok(!!_, '_'); ok(!!Backbone, 'Backbone'); ok(!!ko, 'ko'); ok(!!kb, 'kb'); ok(!!kb.PaneNavigator, 'kb.PaneNavigator')
+ )
+
+ test("1. Basic Usage", ->
+ # kb.statistics = new kb.Statistics() # turn on stats
+
+ el = $('<div></div>')[0]
+ page_navigator = new kb.PaneNavigator(el)
+ equal(el, page_navigator.el, "container element")
+
+ # equal(kb.statistics.registeredStatsString('all released'), 'all released', "Cleanup: stats"); kb.statistics = null
+ )
+ )
+)
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
+<head>
+ <title>Knockback.PaneNavigator Test Suite (AMD)</title>
+ <script src="../vendor/require.js"></script>
+ <script type="text/javascript">
+ require.config({
+ paths: {
+ 'underscore': "../vendor/underscore-1.3.3",
+ 'backbone': "../vendor/backbone-0.9.2",
+ 'knockout': "../vendor/knockout-2.1.0",
+ 'knockback': "../vendor/knockback-core-0.16.5",
+ 'knockback-pane-navigator': "../../knockback-pane-navigator",
+ }
+ });
+ </script>
+
+ <!-- TESTS -->
+ <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>
+ <script type="text/javascript" src="../vendor/qunit/jslitmus.js"></script>
+ <script type="text/javascript" src="build/test-amd.js"></script>
+</head>
+<body>
+ <div>
+ <h1 id="qunit-header">Knockback.PaneNavigator Test Suite (AMD)</h1>
+ <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>
@@ -10,19 +10,15 @@ $(document).ready( ->
require('knockback-pane-navigator') if (typeof(require) isnt 'undefined')
test("TEST DEPENDENCY MISSING", ->
- ok(!!ko, 'ko')
- ok(!!_, '_')
- ok(!!Backbone, 'Backbone')
- ok(!!kb, 'kb')
- ok(!!kb, 'kb')
- ok(!!kb.PaneNavigator, 'kb.PaneNavigator')
+ ok(!!_, '_'); ok(!!Backbone, 'Backbone'); ok(!!ko, 'ko'); ok(!!kb, 'kb'); ok(!!kb.PaneNavigator, 'kb.PaneNavigator')
)
test("1. Basic Usage", ->
# kb.statistics = new kb.Statistics() # turn on stats
el = $('<div></div>')[0]
pane_navigator = new kb.PaneNavigator(el)
+ equal(el, pane_navigator.el, "container element")
# equal(kb.statistics.registeredStatsString('all released'), 'all released', "Cleanup: stats"); kb.statistics = null
)
Oops, something went wrong.

0 comments on commit cc5ccfa

Please sign in to comment.