add comments
[fnpeditor.git] / tests / main.js
index 8a093d9..e2028fa 100644 (file)
@@ -1,15 +1,58 @@
-(function() {\r
-\r
-    mocha.setup('tdd');\r
-\r
-    var tests = Object.keys(window.__karma__.files).filter(function (file) {\r
-      return /\.test\.js$/.test(file);\r
-    });\r
-\r
-    require({\r
-      baseUrl: '/base/',\r
-      deps: tests,\r
-      callback: window.__karma__.start\r
-    });\r
-\r
+(function() {
+
+    mocha.setup('bdd');
+
+    var tests = Object.keys(window.__karma__.files).filter(function (file) {
+      return (/\.test\.js$/).test(file);
+    });
+
+    /* globals window */
+    // This installs noop i18n functions so that tests can work with i18nized code
+    window.gettext = window.interpolate = function() {
+        return Array.prototype.slice.call(arguments, 0);
+    };
+
+    require({
+      baseUrl: '/base/src/editor',
+      deps: tests,
+      callback: window.__karma__.start,
+
+        paths: {
+            'fnpjs': '../fnpjs',
+            'libs': '../../libs',
+            'smartxml': '../smartxml',
+            'wlxml': '../wlxml'
+        },
+
+        map: {
+            '*':
+                {
+                    'libs/jquery': '../../libs/jquery-1.9.1.min',
+                    'libs/underscore': '../../libs/underscore-min',
+                    'libs/bootstrap': '../../libs/bootstrap/js/bootstrap.min',
+                    'libs/backbone': '../../libs/backbone-min',
+                    'libs/sinon': '../../libs/sinon-1.7.3'
+                }
+        },
+
+        shim: {
+            '../../libs/jquery-1.9.1.min': {
+                exports: '$',
+            },
+            '../../libs/underscore-min': {
+                exports: '_'
+            },
+            '../../libs/bootstrap/js/bootstrap.min': {
+                deps: ['libs/jquery']
+            },
+            '../../libs/backbone-min': {
+                exports: 'Backbone',
+                deps: ['libs/jquery', 'libs/underscore']
+            },
+            '../../libs/sinon-1.7.3': {
+                exports: 'sinon'
+            }
+        }
+    });
+
 })();
\ No newline at end of file