X Tutup
Skip to content

Commit 03df6cb

Browse files
committed
New Angular Scenario runner and DSL system with redesigned HTML UI.
Uses the Jasmine syntax for tests, ex: describe('widgets', function() { it('should verify that basic widgets work', function(){ navigateTo('widgets.html'); input('text.basic').enter('Carlos'); expect(binding('text.basic')).toEqual('Carlos'); input('text.basic').enter('Carlos Santana'); expect(binding('text.basic')).not().toEqual('Carlos Boozer'); input('text.password').enter('secret'); expect(binding('text.password')).toEqual('secret'); expect(binding('text.hidden')).toEqual('hiddenValue'); expect(binding('gender')).toEqual('male'); input('gender').select('female'); expect(binding('gender')).toEqual('female'); }); }); Note: To create new UI's implement the interface shown in angular.scenario.ui.Html.
1 parent 0f10431 commit 03df6cb

32 files changed

+1979
-900
lines changed

Rakefile

Lines changed: 65 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
include FileUtils
22

3+
ANGULAR = [
4+
'src/Angular.js',
5+
'src/JSON.js',
6+
'src/Compiler.js',
7+
'src/Scope.js',
8+
'src/Injector.js',
9+
'src/Parser.js',
10+
'src/Resource.js',
11+
'src/Browser.js',
12+
'src/jqLite.js',
13+
'src/apis.js',
14+
'src/filters.js',
15+
'src/formatters.js',
16+
'src/validators.js',
17+
'src/services.js',
18+
'src/directives.js',
19+
'src/markups.js',
20+
'src/widgets.js',
21+
'src/AngularPublic.js',
22+
]
23+
24+
ANGULAR_SCENARIO = [
25+
'src/scenario/Scenario.js',
26+
'src/scenario/Application.js',
27+
'src/scenario/Describe.js',
28+
'src/scenario/Future.js',
29+
'src/scenario/HtmlUI.js',
30+
'src/scenario/Describe.js',
31+
'src/scenario/Runner.js',
32+
'src/scenario/SpecRunner.js',
33+
'src/scenario/dsl.js',
34+
'src/scenario/matchers.js',
35+
]
36+
37+
GENERATED_FILES = [
38+
'angular-debug.js',
39+
'angular-minified.js',
40+
'angular-minified.map',
41+
'angular-scenario.js',
42+
]
43+
344
task :default => [:compile, :test]
445

546
desc 'Generate Externs'
@@ -20,31 +61,27 @@ task :compile_externs do
2061
out.close
2162
end
2263

64+
desc 'Clean Generated Files'
65+
task :clean do
66+
GENERATED_FILES.each do |file|
67+
`rm #{file}`
68+
end
69+
end
70+
2371
desc 'Compile Scenario'
2472
task :compile_scenario do
25-
concat = %x(cat \
26-
lib/jquery/jquery-1.4.2.js \
27-
src/scenario/angular.prefix \
28-
src/Angular.js \
29-
src/jqLite.js \
30-
src/JSON.js \
31-
src/Scope.js \
32-
src/Injector.js \
33-
src/Parser.js \
34-
src/Resource.js \
35-
src/Browser.js \
36-
src/apis.js \
37-
src/services.js \
38-
src/AngularPublic.js \
39-
src/scenario/DSL.js \
40-
src/scenario/Future.js \
41-
src/scenario/Matcher.js \
42-
src/scenario/Runner.js \
43-
src/scenario/angular.suffix \
44-
)
73+
74+
deps = [
75+
'lib/jquery/jquery-1.4.2.js',
76+
'src/scenario/angular.prefix',
77+
ANGULAR,
78+
ANGULAR_SCENARIO,
79+
'src/scenario/angular.suffix',
80+
]
4581
css = %x(cat css/angular-scenario.css)
82+
concat = 'cat ' + deps.flatten.join(' ')
4683
f = File.new("angular-scenario.js", 'w')
47-
f.write(concat)
84+
f.write(%x{#{concat}})
4885
f.write('document.write(\'<style type="text/css">\n')
4986
f.write(css.gsub(/'/, "\\'").gsub(/\n/, "\\n"));
5087
f.write('\n</style>\');')
@@ -54,30 +91,14 @@ end
5491
desc 'Compile JavaScript'
5592
task :compile => [:compile_externs, :compile_scenario] do
5693

57-
concat = %x(cat \
58-
src/angular.prefix \
59-
src/Angular.js \
60-
src/JSON.js \
61-
src/Compiler.js \
62-
src/Scope.js \
63-
src/Injector.js \
64-
src/Parser.js \
65-
src/Resource.js \
66-
src/Browser.js \
67-
src/jqLite.js \
68-
src/apis.js \
69-
src/filters.js \
70-
src/formatters.js \
71-
src/validators.js \
72-
src/services.js \
73-
src/directives.js \
74-
src/markups.js \
75-
src/widgets.js \
76-
src/AngularPublic.js \
77-
src/angular.suffix \
78-
)
94+
deps = [
95+
'src/angular.prefix',
96+
ANGULAR,
97+
'src/angular.suffix',
98+
]
7999
f = File.new("angular-debug.js", 'w')
80-
f.write(concat)
100+
concat = 'cat ' + deps.flatten.join(' ')
101+
f.write(%x{#{concat}})
81102
f.close
82103

83104
%x(java -jar lib/compiler-closure/compiler.jar \

css/angular-scenario.css

Lines changed: 167 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,199 @@
11
@charset "UTF-8";
22
/* CSS Document */
33

4-
#runner {
5-
position: absolute;
6-
top:5px;
7-
left:10px;
8-
right:10px;
9-
height: 200px;
4+
/** Structure */
5+
body {
6+
font-family: Arial, sans-serif;
7+
margin: 0;
8+
font-size: 14px;
109
}
1110

12-
.console {
13-
display: block;
14-
overflow: scroll;
15-
height: 200px;
16-
border: 1px solid black;
11+
#header {
12+
position: fixed;
13+
width: 100%;
14+
}
15+
16+
#specs {
17+
padding-top: 50px;
18+
}
19+
20+
#header .angular {
21+
font-family: Courier New, monospace;
22+
font-weight: bold;
23+
}
24+
25+
#header h1 {
26+
font-weight: normal;
27+
float: left;
28+
font-size: 30px;
29+
line-height: 30px;
30+
margin: 0;
31+
padding: 10px 10px;
32+
height: 30px;
33+
}
34+
35+
#frame h2,
36+
#specs h2 {
37+
margin: 0;
38+
padding: 0.5em;
39+
font-size: 1.1em;
40+
}
41+
42+
#status-legend {
43+
margin-top: 10px;
44+
margin-right: 10px;
45+
}
46+
47+
#header,
48+
#frame,
49+
.test-info,
50+
.test-actions li {
51+
overflow: hidden;
1752
}
1853

19-
#testView {
20-
position: absolute;
21-
bottom:10px;
22-
top:230px;
23-
left:10px;
24-
right:10px;
54+
#frame {
55+
margin: 10px;
2556
}
2657

27-
#testView iframe {
58+
#frame iframe {
2859
width: 100%;
29-
height: 100%;
60+
height: 758px;
61+
}
62+
63+
#frame .popout {
64+
float: right;
3065
}
3166

32-
li.running > span {
33-
background-color: yellow;
67+
#frame iframe {
68+
border: none;
69+
}
70+
71+
.tests li,
72+
.test-actions li,
73+
.test-it li,
74+
.test-it ol,
75+
.status-display {
76+
list-style-type: none;
3477
}
3578

36-
#runner span {
37-
background-color: green;
79+
.tests,
80+
.test-it ol,
81+
.status-display {
82+
margin: 0;
83+
padding: 0;
3884
}
3985

40-
#runner .fail > span {
41-
background-color: red;
86+
.test-info {
87+
margin-left: 1em;
88+
margin-top: 0.5em;
89+
border-radius: 8px 0 0 8px;
90+
-webkit-border-radius: 8px 0 0 8px;
91+
-moz-border-radius: 8px 0 0 8px;
92+
}
93+
94+
.test-it ol {
95+
margin-left: 2.5em;
4296
}
4397

44-
.collapsed > ul {
45-
display: none;
98+
.status-display,
99+
.status-display li {
100+
float: right;
46101
}
47102

48-
//////
103+
.status-display li {
104+
padding: 5px 10px;
105+
}
49106

50-
.run, .info, .error {
51-
display: block;
52-
padding: 0 1em;
107+
.timer-result,
108+
.test-title {
109+
display: inline-block;
110+
margin: 0;
111+
padding: 4px;
112+
}
113+
114+
.timer-result {
115+
width: 4em;
116+
padding: 0 10px;
117+
text-align: right;
53118
font-family: monospace;
54-
white-space: pre;
55119
}
56120

57-
.run {
58-
background-color: lightgrey;
59-
padding: 0 .2em;
121+
.test-it pre,
122+
.test-actions pre {
123+
clear: left;
124+
margin-left: 6em;
60125
}
61126

62-
.run.pass {
63-
background-color: lightgreen;
127+
.test-describe .test-describe {
128+
margin: 5px 5px 10px 2em;
64129
}
65130

66-
.run.fail {
67-
background-color: lightred;
131+
.test-actions .status-pending .test-title:before {
132+
content: '» ';
133+
}
134+
135+
/** Colors */
136+
137+
#header {
138+
background-color: #F2C200;
68139
}
69140

70-
.name, .time, .state {
71-
padding-right: 2em;
141+
#specs h2 {
142+
border-top: 2px solid #BABAD1;
72143
}
73144

74-
error {
75-
color: red;
76-
}
145+
#specs h2,
146+
#frame h2 {
147+
background-color: #efefef;
148+
}
149+
150+
#frame {
151+
border: 1px solid #BABAD1;
152+
}
153+
154+
.test-describe .test-describe {
155+
border-left: 1px solid #BABAD1;
156+
border-right: 1px solid #BABAD1;
157+
border-bottom: 1px solid #BABAD1;
158+
}
159+
160+
.status-display {
161+
border: 1px solid #777;
162+
}
163+
164+
.status-display .status-pending,
165+
.status-pending .test-info {
166+
background-color: #F9EEBC;
167+
}
168+
169+
.status-display .status-success,
170+
.status-success .test-info {
171+
background-color: #B1D7A1;
172+
}
173+
174+
.status-display .status-failure,
175+
.status-failure .test-info {
176+
background-color: #FF8286;
177+
}
178+
179+
.status-display .status-error,
180+
.status-error .test-info {
181+
background-color: black;
182+
color: white;
183+
}
184+
185+
.test-actions .status-success .test-title {
186+
color: #30B30A;
187+
}
188+
189+
.test-actions .status-failure .test-title {
190+
color: #DF0000;
191+
}
192+
193+
.test-actions .status-error .test-title {
194+
color: black;
195+
}
196+
197+
.test-actions .timer-result {
198+
color: #888;
199+
}

jsTestDriver-jquery.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ load:
99
- src/JSON.js
1010
- src/*.js
1111
- test/testabilityPatch.js
12-
- src/scenario/Runner.js
12+
- src/scenario/Scenario.js
1313
- src/scenario/*.js
1414
- test/angular-mocks.js
1515
- test/scenario/*.js

jsTestDriver.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ load:
99
- src/JSON.js
1010
- src/*.js
1111
- test/testabilityPatch.js
12-
- src/scenario/Runner.js
12+
- src/scenario/Scenario.js
1313
- src/scenario/*.js
1414
- test/angular-mocks.js
1515
- test/scenario/*.js

0 commit comments

Comments
 (0)
X Tutup