Permalink
Browse files

added modules 1.1.1 tests

  • Loading branch information...
1 parent 9ca8c41 commit ef21c5cc1df601d981afe4b76d5b6f0502950811 @Jakobo Jakobo committed Dec 2, 2011
View
@@ -8,6 +8,7 @@
<script type="text/javascript" src="/inject.js"></script>
<script type="text/javascript" src="/tests/modules-1.0.js"></script>
<script type="text/javascript" src="/tests/modules-1.1.js"></script>
+ <script type="text/javascript" src="/tests/modules-1.1.1.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Test Suite</h1>
@@ -0,0 +1,41 @@
+module("CommonJS: Modules 1.1.1 - same domain", {
+ setup: function() {
+ if (localStorage) {
+ localStorage.clear();
+ }
+ Inject.reset();
+ require.setModuleRoot("http://localhost:4000/tests/requires/modules-1.1.1");
+ },
+ teardown: function() {
+ if (localStorage) {
+ localStorage.clear();
+ }
+ }
+});
+
+asyncTest("run program.js", 5, function() {
+ require.run("program");
+});
+
+
+
+module("CommonJS: Modules 1.1.1 - different domain", {
+ setup: function() {
+ if (localStorage) {
+ localStorage.clear();
+ }
+ Inject.reset();
+ require.setModuleRoot("http://localhost:4001/tests/requires/modules-1.1.1");
+ require.setCrossDomain("http://localhost:4000/relay.html",
+ "http://localhost:4001/relay.html");
+ },
+ teardown: function() {
+ if (localStorage) {
+ localStorage.clear();
+ }
+ }
+});
+
+asyncTest("run program.js", 5, function() {
+ require.run("program");
+});
@@ -0,0 +1,6 @@
+var add = require('math').add;
+exports.increment = function(val) {
+ return add(val, 1);
+};
+
+ok(true, "increment.js loaded");
@@ -0,0 +1,9 @@
+exports.add = function() {
+ var sum = 0, i = 0, args = arguments, l = args.length;
+ while (i < l) {
+ sum += args[i++];
+ }
+ return sum;
+};
+
+ok(true, "math.js loaded");
@@ -0,0 +1,7 @@
+var inc = require('increment').increment;
+var a = 1;
+equal(inc(a), 2, "increment a");
+equal(module.id, "program", "module.id is set");
+
+ok(true, "program.js loaded");
+start();

0 comments on commit ef21c5c

Please sign in to comment.