Commit 976859632fcd277ea72471b17b3631ca7cc63e1c
1 parent
1ac51353
Exists in
jasmine-testing
Refactor html jasmine runner to include requirejs-config.js paths mapper
Showing
2 changed files
with
45 additions
and
84 deletions
Show diff stats
test/SpecRunner.html
... | ... | @@ -7,97 +7,59 @@ |
7 | 7 | <link rel="shortcut icon" type="image/png" href="lib/jasmine-2.2.0/jasmine_favicon.png"> |
8 | 8 | <link rel="stylesheet" href="lib/jasmine-2.2.0/jasmine.css"> |
9 | 9 | |
10 | - <!-- // <script src="lib/jasmine-2.2.0/jasmine.js"></script> | |
11 | - // <script src="lib/jasmine-2.2.0/jasmine-html.js"></script> --> | |
12 | - <!-- // <script src="lib/jasmine-2.2.0/boot.js"></script> --> | |
13 | - | |
14 | - <script type="text/javascript"> | |
15 | - | |
16 | - var require = { | |
17 | - paths: { | |
18 | - "domReady": "lib/requirejs-plugins/domReady", | |
19 | - "model": "../js", | |
20 | - "handlebars": '../js/handlebars-v3.0.1', | |
21 | - "handlebars_helpers": '../js/handlebars-helpers', | |
22 | - "jquery":'../js/jquery-2.1.3.min', | |
23 | - "jquery_cookie":'../js/jquery.cookie', | |
24 | - "jasmine":'lib/jasmine-2.2.0/jasmine', | |
25 | - "jasmine-html":'lib/jasmine-2.2.0/jasmine-html', | |
26 | - "jasmine-jquery":'lib/jasmine-plugins/jasmine-jquery', | |
27 | - "jasmine-boot":'lib/jasmine-2.2.0/boot' | |
28 | - }, | |
29 | - shim:{ | |
30 | - jasmine:{ | |
31 | - exports: 'jasmine' | |
32 | - }, | |
33 | - 'jasmine-html':{ | |
34 | - deps:['jasmine'], | |
35 | - exports: 'jasmine' | |
36 | - }, | |
37 | - 'jasmine-boot':{ | |
38 | - deps:['jasmine-html','jasmine'], | |
39 | - exports:'jasmine' | |
40 | - } | |
41 | - } | |
42 | - }; | |
43 | - | |
44 | - </script> | |
45 | - | |
46 | - <script src="../js/require.js"></script> | |
47 | - | |
48 | - <!-- // <script src="../js/handlebars-v3.0.1.js"></script> --> | |
49 | - <!-- // <script src="../js/handlebars-helpers.js"></script> --> | |
50 | - | |
51 | 10 | <!-- include source files here... --> |
52 | - <!-- <script src="../js/main.js"></script> --> | |
11 | + <script src="../js/require.js"></script> | |
53 | 12 | |
54 | - <!-- include spec files here... --> | |
13 | + <!-- include spec files here...if you not use require.js library --> | |
55 | 14 | |
56 | 15 | <script type="text/javascript"> |
57 | 16 | |
58 | - require( | |
59 | - [ | |
60 | - "domReady!", | |
61 | - "spec/MainSpec" | |
62 | - ], | |
63 | - function( jasmine ){ | |
64 | - | |
65 | - // window.jasmine = jasmineRequire.core(jasmineRequire); | |
66 | - // | |
67 | - // jasmineRequire.html(jasmine); | |
68 | - // | |
69 | - // var jasmineEnv = jasmine.getEnv(); | |
70 | - // jasmineEnv.updateInterval = 1000; | |
71 | - // | |
72 | - // var htmlReporter = new jasmine.HtmlReporter(); | |
73 | - // | |
74 | - // jasmineEnv.addReporter(htmlReporter); | |
75 | - // | |
76 | - // jasmineEnv.specFilter = function (spec) { | |
77 | - // return htmlReporter.specFilter(spec); | |
78 | - // }; | |
79 | - | |
80 | - | |
81 | - // Set up the HTML reporter - this is reponsible for | |
82 | - // aggregating the results reported by Jasmine as the | |
83 | - // tests and suites are executed. | |
84 | - // jasmine.getEnv().addReporter( | |
85 | - // new jasmine.HtmlReporter() | |
86 | - // ); | |
87 | - // | |
88 | - // // Run all the loaded test specs. | |
89 | - // jasmine.getEnv().execute(); | |
90 | - if(typeof window.onload == 'function'){ | |
91 | - window.onload(); | |
17 | + require(['../js/requirejs-config'],function(){ | |
18 | + | |
19 | + require.config({ | |
20 | + paths: { | |
21 | + "jasmine": test+'/lib/jasmine-2.2.0/jasmine', | |
22 | + "jasmine-html": test+'/lib/jasmine-2.2.0/jasmine-html', | |
23 | + "jasmine-jquery": test+'/lib/jasmine-plugins/jasmine-jquery', | |
24 | + "jasmine-boot": test+'/lib/jasmine-2.2.0/boot', | |
25 | + "domReady": test+'/lib/requirejs-plugins/domReady' | |
26 | + }, | |
27 | + shim:{ | |
28 | + jasmine:{ | |
29 | + exports: 'jasmine' | |
30 | + }, | |
31 | + 'jasmine-html':{ | |
32 | + deps:['jasmine'], | |
33 | + exports: 'jasmine' | |
34 | + }, | |
35 | + 'jasmine-boot':{ | |
36 | + deps:['jasmine-html','jasmine'], | |
37 | + exports:'jasmine' | |
38 | + } | |
39 | + } | |
40 | + }); | |
41 | + | |
42 | + require( | |
43 | + [ | |
44 | + "domReady!", | |
45 | + "./spec/MainSpec.js" | |
46 | + ], | |
47 | + function(){ | |
48 | + | |
49 | + /* Run all the loaded test specs. | |
50 | + * | |
51 | + * @see boot.js file that contains a jasmine.getEnv().execute() | |
52 | + * function added to window.onload event | |
53 | + */ | |
54 | + if(typeof window.onload == 'function'){ | |
55 | + window.onload(); | |
56 | + } | |
92 | 57 | } |
93 | - } | |
94 | - ); | |
58 | + ); | |
59 | + }); | |
95 | 60 | |
96 | 61 | </script> |
97 | 62 | |
98 | - | |
99 | - <!-- // <script src="spec/MainSpec.js"></script> --> | |
100 | - | |
101 | 63 | </head> |
102 | 64 | |
103 | 65 | <body> | ... | ... |
test/spec/MainSpec.js
1 | -define(['jasmine-boot', 'model/proposal-app'],function(jasmine, ProposalApp){ | |
1 | +define(['jasmine-boot', 'proposal_app'],function(jasmine, ProposalApp){ | |
2 | 2 | |
3 | 3 | describe("Limit proposal voting to one per browser", function(){ |
4 | 4 | it("Should register a proposal id", function(){ |
... | ... | @@ -12,5 +12,4 @@ define(['jasmine-boot', 'model/proposal-app'],function(jasmine, ProposalApp){ |
12 | 12 | |
13 | 13 | }); |
14 | 14 | |
15 | - | |
16 | 15 | }); | ... | ... |