~caneypuggies/reformedchurcheslocator/couchapp-backbone

« back to all changes in this revision

Viewing changes to _attachments/js/vendor/requirejs/tests/queryPath.html

  • 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
<!DOCTYPE html>
 
2
<html>
 
3
<head>
 
4
    <title>require.js: Querystring Path Test</title>
 
5
    <script type="text/javascript" src="../require.js"></script>
 
6
    <script type="text/javascript" src="doh/runner.js"></script>
 
7
    <script type="text/javascript" src="doh/_browserRunner.js"></script>
 
8
    <script>
 
9
    require.config({
 
10
        paths: {
 
11
            'one': 'one.js?some=thing'
 
12
        }
 
13
    });
 
14
 
 
15
    require(['one', 'two'], function (one, two) {
 
16
        doh.register(
 
17
            "queryPath",
 
18
            [
 
19
                function queryPath(t){
 
20
                    t.is('large', one.size);
 
21
                    t.is('small', two.size);
 
22
 
 
23
                    //Get all the script tags, make sure the one for
 
24
                    //'one' ends in 'one.js?some=thing' and the one
 
25
                    //for 'two' ends in 'two.js'
 
26
                    var i, tag, id, src,
 
27
                        tags = document.getElementsByTagName('script'),
 
28
                        found = 0;
 
29
 
 
30
                    for (i = tags.length - 1; i > -1; i--) {
 
31
                        tag = tags[i];
 
32
                        id = tag.getAttribute('data-requiremodule');
 
33
                        src = tag.src;
 
34
                        if (id === 'one') {
 
35
                            t.is(true, /one\.js\?some\=thing$/.test(src), 'no .js added');
 
36
                            found += 1;
 
37
                        } else if (id === 'two') {
 
38
                            t.is(true, /two\.js$/.test(src), 'has .js added');
 
39
                            found += 1;
 
40
                        }
 
41
                    }
 
42
                    t.is(2, found);
 
43
                }
 
44
            ]
 
45
        );
 
46
 
 
47
        doh.run();
 
48
    });
 
49
 
 
50
    </script>
 
51
</head>
 
52
<body>
 
53
    <h1>require.js: Querystring Path Test</h1>
 
54
    <p>Check console for messages</p>
 
55
</body>
 
56
</html>