~caneypuggies/reformedchurcheslocator/couchapp-backbone

« back to all changes in this revision

Viewing changes to _attachments/js/vendor/requirejs/tests/requirePluginLoad/requirePluginLoad-tests.js

  • Committer: Tim Black
  • Date: 2013-09-16 22:50:16 UTC
  • Revision ID: tim@alwaysreformed.com-20130916225016-zk8jiba25z33ew7h
Versioned Bower vendor directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
var globals = {};
 
3
 
 
4
define('plug',{
 
5
    load: function () {
 
6
        throw new Error('Cannot dynamically load');
 
7
    }
 
8
});
 
9
 
 
10
define('app/test',[], function() {
 
11
    return { name: 'test' };
 
12
});
 
13
 
 
14
define('app/test2',[], function() {
 
15
    return { name: 'test2' };
 
16
});
 
17
 
 
18
define('plug!app/main',["!app/test", "!app/test2"], function(test, test2) {
 
19
    return {
 
20
        name: 'main',
 
21
        test: test,
 
22
        test2: test2
 
23
    };
 
24
});
 
25
 
 
26
require(["plug!app/main"],
 
27
    function(main) {
 
28
        globals.main = main;
 
29
    }
 
30
);
 
31
define("app/run", function(){});
 
32
 
 
33
 
 
34
require({
 
35
        baseUrl: "./"
 
36
    },
 
37
    ["app/run"],
 
38
    function() {
 
39
        require(["plug!app/main"], function () {
 
40
            doh.register(
 
41
                "requirePluginLoad",
 
42
                [
 
43
                    function requirePluginLoad(t){
 
44
                        var main = globals.main;
 
45
 
 
46
                        t.is("main", main.name);
 
47
                        t.is("test", main.test.name);
 
48
                        t.is("test2", main.test2.name);
 
49
                    }
 
50
                ]
 
51
            );
 
52
 
 
53
            doh.run();
 
54
        });
 
55
    }
 
56
);