Merge lp:~benji/juju-gui/bug-1104105-browser-compatability-warning-3 into lp:juju-gui/experimental

Proposed by Benji York
Status: Merged
Merged at revision: 377
Proposed branch: lp:~benji/juju-gui/bug-1104105-browser-compatability-warning-3
Merge into: lp:juju-gui/experimental
Diff against target: 499 lines (+215/-53)
12 files modified
.bzrignore (+2/-0)
Makefile (+33/-15)
app/app.js (+1/-1)
app/index.html (+85/-8)
app/templates/login.handlebars (+3/-3)
app/views/login.js (+4/-4)
lib/merge-files.js (+4/-1)
lib/views/stylesheet.less (+19/-18)
test/index.html (+1/-0)
test/test_login.js (+3/-3)
test/test_startup.js.bottom (+50/-0)
test/test_startup.js.top (+10/-0)
To merge this branch: bzr merge lp:~benji/juju-gui/bug-1104105-browser-compatability-warning-3
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+147448@code.launchpad.net

Description of the change

Add a warning about unsupported browsers.

The tests for the code are a bit unusual in that the code under test is
embedded in an HTML file, so it must be extracted and the test file built my
the Makefile so it can be tested. I don't think this approach is too heinous.

https://codereview.appspot.com/7299071/

To post a comment you must log in.
383. By Benji York

merge trunk and resolve conflict

Revision history for this message
Brad Crittenden (bac) wrote :

The branch looks good, thanks Benji. One change to make before landing.

https://codereview.appspot.com/7299071/diff/3001/app/index.html
File app/index.html (right):

https://codereview.appspot.com/7299071/diff/3001/app/index.html#newcode41
app/index.html:41: Your browser not fully supported.</span>
Please change to: Your browser is not fully supported.

https://codereview.appspot.com/7299071/

Revision history for this message
Gary Poster (gary) wrote :

Hi Benji. Interesting test approach that is cool. Will think about it
more.

I raised the concern on IRC last week that make prod appears to be
broken. Here are some other review comments. I'll re-review when you
have these addressed and make prod fixed.

Thank you

Gary

https://codereview.appspot.com/7299071/diff/3001/Makefile
File Makefile (right):

https://codereview.appspot.com/7299071/diff/3001/Makefile#newcode523
Makefile:523: server spritegen test test-debug test-prod undocumented \
test-prep too, yeah?

https://codereview.appspot.com/7299071/diff/3001/app/index.html
File app/index.html (right):

https://codereview.appspot.com/7299071/diff/3001/app/index.html#newcode41
app/index.html:41: Your browser not fully supported.</span>
add an "is" in there please.

On IE 10 this is two lines, even without the is, which is a shame. It
would be nice if the panel were wider. I might mess with that.

https://codereview.appspot.com/7299071/diff/3001/app/index.html#newcode50
app/index.html:50: <a href="http://www.google.com/chrome">Chrome</a> to
be fully
I think we ought to say Firefox here too. Maybe we wait for CI for
that. If so, please make a bug about this ("Firefox is not regularly
tested" with description mentioning that CI is fix for this bug, and
that this message should be updated when it is).

https://codereview.appspot.com/7299071/diff/3001/app/index.html#newcode113
app/index.html:113: startTheApp = function() {
Unless someone corrects me, I'll assert that is a matter of good
practice to always use var declarations, even at the top level where
they technically are equivalent to what you have written here. Unless
someone argues against them, please add var statements here and below.
(see pastebin from next comment)

https://codereview.appspot.com/7299071/diff/3001/app/index.html#newcode150
app/index.html:150: </script>
This ordering does not accomplish the workflow we want, described in the
graphic assets. The browser warning should be shown before we load the
JS. I think this is one approach to get what we want:
http://pastebin.ubuntu.com/1636315/ . I suspect there are more elegant
ones.

https://codereview.appspot.com/7299071/diff/3001/lib/views/stylesheet.less
File lib/views/stylesheet.less (right):

https://codereview.appspot.com/7299071/diff/3001/lib/views/stylesheet.less#newcode1433
lib/views/stylesheet.less:1433: width: 300px;
I'd like to see what this looks like expanded a bit. The goal would be
to have the text fit in a single line at the top, while still looking
good for login.

https://codereview.appspot.com/7299071/

384. By Benji York

fix prod and tweak widths to reduce line breaks

385. By Benji York

review fixes

386. By Benji York

fix lint

387. By Benji York

fix lint

Revision history for this message
Gary Poster (gary) wrote :

Land with changes, unless you argue against the changes.

Cool, thank you, and thanks for the source fix. Works well for me.
What was the make prod problem?

The box is still not wide enough for me on FF, but is fine on IE. could
you push ".centered-column div" and ".centered-column .panel
input[type="submit"]" out from 260px to 280px, and ".centered-column
.panel input" out to 270px, unless you disagree? I think the design
folks might want to tweak, but not breaking the header text across lines
is more important than the arguably less attractive proportions of the
wider box, IMO.

https://codereview.appspot.com/7299071/diff/3002/app/index.html
File app/index.html (right):

https://codereview.appspot.com/7299071/diff/3002/app/index.html#newcode108
app/index.html:108: <script id="app-startup">
You could protect all of these functions in a function(){[CODE]}()
namespace hack to keep them out of the global namespace. startTheApp is
the only one that would need to be global.

https://codereview.appspot.com/7299071/diff/3002/app/index.html#newcode109
app/index.html:109: isBrowserSupported = function(agent) {
Suggest "var isBrowserSupported = function(agent) {"

This is nicer for variable definition, and would work as desired within
the namespace hack I mention.

OTOH, if you don't use var, "function isBrowserSupported(agent) {" is
identical in semantics, at least as clear, and more concise.

https://codereview.appspot.com/7299071/diff/3002/app/index.html#newcode114
app/index.html:114: getDocument = function() {
Same var discussion

https://codereview.appspot.com/7299071/diff/3002/app/index.html#newcode118
app/index.html:118: displayBrowserWarning = function() {
Same var discussion

https://codereview.appspot.com/7299071/diff/3002/app/index.html#newcode123
app/index.html:123: continueWithCurrentBrowser = function() {
Same var discussion

https://codereview.appspot.com/7299071/diff/3002/app/index.html#newcode130
app/index.html:130: startTheApp = function() {
Same var discussion, except that it needs to be global as you've
implemented it here.

https://codereview.appspot.com/7299071/diff/3002/app/index.html#newcode136
app/index.html:136: window.setTimeout('startTheApp', 100);
Heh. Yeah, I considered this approach too. My global flag was grody in
my book, but so was this. I leaned toward the global flag, then, but
<shrug>.

https://codereview.appspot.com/7299071/diff/3002/app/index.html#newcode139
app/index.html:139: go = function() {
Same var discussion

https://codereview.appspot.com/7299071/diff/3002/lib/merge-files.js
File lib/merge-files.js (right):

https://codereview.appspot.com/7299071/diff/3002/lib/merge-files.js#newcode50
lib/merge-files.js:50: result.code += '\n//@ sourceMappingURL=' +
sourceMapName;
Good catch. Seems silly that we have to do this.

https://codereview.appspot.com/7299071/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2013-02-01 20:27:02 +0000
+++ .bzrignore 2013-02-11 17:53:23 +0000
@@ -20,3 +20,5 @@
20build-debug20build-debug
21bin/py21bin/py
22python-shelltoolbox22python-shelltoolbox
23test/test_startup.js
24test/extracted_startup_code
2325
=== modified file 'Makefile'
--- Makefile 2013-02-08 17:46:45 +0000
+++ Makefile 2013-02-11 17:53:23 +0000
@@ -33,12 +33,13 @@
33 -e '^server.js$$')33 -e '^server.js$$')
34THIRD_PARTY_JS=app/assets/javascripts/reconnecting-websocket.js34THIRD_PARTY_JS=app/assets/javascripts/reconnecting-websocket.js
35NODE_TARGETS=node_modules/chai node_modules/cryptojs node_modules/d3 \35NODE_TARGETS=node_modules/chai node_modules/cryptojs node_modules/d3 \
36 node_modules/expect.js node_modules/express node_modules/graceful-fs \36 node_modules/expect.js node_modules/express \
37 node_modules/grunt node_modules/jshint node_modules/less \37 node_modules/graceful-fs node_modules/grunt node_modules/jshint \
38 node_modules/minimatch node_modules/mocha node_modules/node-markdown \38 node_modules/less node_modules/minimatch node_modules/mocha \
39 node_modules/node-minify node_modules/node-spritesheet \39 node_modules/node-markdown node_modules/node-minify \
40 node_modules/rimraf node_modules/should node_modules/yui \40 node_modules/node-spritesheet node_modules/recess \
41 node_modules/yuidocjs node_modules/recess41 node_modules/rimraf node_modules/should node_modules/uglify-js \
42 node_modules/yui node_modules/yuidocjs
42EXPECTED_NODE_TARGETS=$(shell echo "$(NODE_TARGETS)" | tr ' ' '\n' | sort \43EXPECTED_NODE_TARGETS=$(shell echo "$(NODE_TARGETS)" | tr ' ' '\n' | sort \
43 | tr '\n' ' ')44 | tr '\n' ' ')
4445
@@ -251,7 +252,7 @@
251 # below without the grep to get recess' report.252 # below without the grep to get recess' report.
252 node_modules/recess/bin/recess lib/views/stylesheet.less --config recess.json | grep -q Perfect253 node_modules/recess/bin/recess lib/views/stylesheet.less --config recess.json | grep -q Perfect
253254
254lint: gjslint jshint recess yuidoc-lint255lint: test-prep gjslint jshint recess yuidoc-lint
255256
256virtualenv/bin/python:257virtualenv/bin/python:
257 virtualenv virtualenv258 virtualenv virtualenv
@@ -271,7 +272,7 @@
271 ln -sf "$(PWD)/node_modules/yui/assets/skins/sam/rail-x.png" \272 ln -sf "$(PWD)/node_modules/yui/assets/skins/sam/rail-x.png" \
272 build-shared/juju-ui/assets/combined-css/rail-x.png273 build-shared/juju-ui/assets/combined-css/rail-x.png
273 bin/merge-files274 bin/merge-files
274 mv *-source-map build-shared/juju-ui/assets/275 mv *.js.map build-shared/juju-ui/assets/
275276
276build-files: $(BUILD_FILES)277build-files: $(BUILD_FILES)
277278
@@ -349,7 +350,7 @@
349$(LINK_PROD_FILES):350$(LINK_PROD_FILES):
350 $(call link-files,prod)351 $(call link-files,prod)
351 ln -sf "$(PWD)/build-shared/juju-ui/assets/all-yui.js" build-prod/juju-ui/assets/352 ln -sf "$(PWD)/build-shared/juju-ui/assets/all-yui.js" build-prod/juju-ui/assets/
352 ln -sf "$(PWD)"/build-shared/juju-ui/assets/*-source-map build-prod/juju-ui/assets/353 ln -sf "$(PWD)"/build-shared/juju-ui/assets/*.js.map build-prod/juju-ui/assets/
353 # Link in the application source code so source maps work.354 # Link in the application source code so source maps work.
354 mkdir -p $(PWD)/build-prod/juju-ui/assets/source355 mkdir -p $(PWD)/build-prod/juju-ui/assets/source
355 ln -s $(PWD)/app $(PWD)/build-prod/juju-ui/assets/source356 ln -s $(PWD)/app $(PWD)/build-prod/juju-ui/assets/source
@@ -357,13 +358,30 @@
357358
358prep: beautify lint359prep: beautify lint
359360
360test-debug: build-debug361test/extracted_startup_code: app/index.html
362 # Pull the JS out of the index so we can run tests against it.
363 cat app/index.html | \
364 sed -n '/<script id="app-startup">/,/<\/script>/p'| \
365 head -n-1 | tail -n+2 > test/extracted_startup_code
366
367test/test_startup.js: test/test_startup.js.top test/test_startup.js.bottom \
368 test/extracted_startup_code
369 # Stitch together the test file for app start-up.
370 echo "// THIS IS A GENERATED FILE. DO NOT EDIT." > $@
371 echo "// See the Makefile for details." >> $@
372 cat test/test_startup.js.top >> $@
373 cat test/extracted_startup_code >> $@
374 cat test/test_startup.js.bottom >> $@
375
376test-prep: test/test_startup.js
377
378test-debug: build-debug test-prep
361 ./test-server.sh debug379 ./test-server.sh debug
362380
363test-prod: build-prod381test-prod: build-prod test-prep
364 ./test-server.sh prod382 ./test-server.sh prod
365383
366test-server: build-debug384test-server: build-debug test-prep
367 ./test-server.sh debug true385 ./test-server.sh debug true
368386
369test-misc:387test-misc:
@@ -500,9 +518,9 @@
500518
501# targets are alphabetically sorted, they like it that way :-)519# targets are alphabetically sorted, they like it that way :-)
502.PHONY: appcache-force appcache-touch beautify build build-files \520.PHONY: appcache-force appcache-touch beautify build build-files \
503 build-devel clean clean-all clean-deps clean-docs code-doc \521 build-devel clean clean-all clean-deps clean-docs code-doc debug \
504 debug devel docs dist gjslint help jshint lint main-doc prep prod \522 devel docs dist gjslint help jshint lint main-doc prep prod recess \
505 recess server spritegen test test-debug test-prod undocumented \523 server spritegen test test-debug test-prep test-prod undocumented \
506 view-code-doc view-docs view-main-doc yuidoc-lint524 view-code-doc view-docs view-main-doc yuidoc-lint
507525
508.DEFAULT_GOAL := all526.DEFAULT_GOAL := all
509527
=== modified file 'app/app.js'
--- app/app.js 2013-02-08 17:36:58 +0000
+++ app/app.js 2013-02-11 17:53:23 +0000
@@ -638,7 +638,7 @@
638 * @private638 * @private
639 */639 */
640 onLogin: function() {640 onLogin: function() {
641 Y.one('body > #login-mask').hide();641 Y.one('body > #full-screen-mask').hide();
642 this.dispatch();642 this.dispatch();
643 },643 },
644644
645645
=== added file 'app/assets/images/alert_icon2.png'
646Binary files app/assets/images/alert_icon2.png 1970-01-01 00:00:00 +0000 and app/assets/images/alert_icon2.png 2013-02-11 17:53:23 +0000 differ646Binary files app/assets/images/alert_icon2.png 1970-01-01 00:00:00 +0000 and app/assets/images/alert_icon2.png 2013-02-11 17:53:23 +0000 differ
=== modified file 'app/index.html'
--- app/index.html 2013-02-07 21:04:01 +0000
+++ app/index.html 2013-02-11 17:53:23 +0000
@@ -30,7 +30,32 @@
30 </head>30 </head>
3131
32 <body>32 <body>
33 <div id="login-mask" class="crosshatch-background"></div>33 <div id="full-screen-mask" class="crosshatch-background">
34 <div id="browser-warning" class="centered-column"
35 style="display:none;">
36 <i class="sprite juju_logo" title="Juju GUI"></i>
37 <div class="panel">
38 <div class="header">
39 <div class="error">
40 <span><i class="sprite alert_icon2"></i>
41 Your browser is not fully supported.</span>
42 </div>
43 </div>
44 <p>
45 If you continue to use Juju with your current browser your
46 experience may not be as good as we would like it to be.
47 </p>
48 <p>
49 Please use the latest version of
50 <a href="http://www.google.com/chrome">Chrome</a> to be fully
51 supported.
52 </p>
53 <form onsubmit="return continueWithCurrentBrowser();">
54 <input type="submit" value="Continue"/>
55 </form>
56 </div>
57 </div>
58 </div>
34 <div id="notifier-box"></div>59 <div id="notifier-box"></div>
35 <div id="viewport-wrapper">60 <div id="viewport-wrapper">
36 <div id="vp-left-border"></div>61 <div id="vp-left-border"></div>
@@ -80,17 +105,69 @@
80 </div>105 </div>
81 <div id="vp-right-border"></div>106 <div id="vp-right-border"></div>
82 </div>107 </div>
83 <!-- javascript away -->108 <script id="app-startup">
109 isBrowserSupported = function(agent) {
110 // At the moment, only Chrome is supported.
111 return (/Chrome/.test(agent));
112 };
113
114 getDocument = function() {
115 return document;
116 };
117
118 displayBrowserWarning = function() {
119 getDocument()
120 .getElementById('browser-warning').style.display = 'block';
121 };
122
123 continueWithCurrentBrowser = function() {
124 getDocument()
125 .getElementById('browser-warning').style.display = 'none';
126 startTheApp();
127 return false;
128 };
129
130 startTheApp = function() {
131 // This function will be redefined when all the app's JavaScript is
132 // loaded. We want to keep trying until that happens.
133
134 // Tell jslint that we really do want to evaluate a string:
135 /*jslint evil: true */
136 window.setTimeout('startTheApp', 100);
137 };
138
139 go = function() {
140 if (isBrowserSupported(navigator.userAgent)) {
141 startTheApp();
142 } else {
143 displayBrowserWarning();
144 }
145 };
146 </script>
147 <!--
148 Load the (potentially slow to download) core of the app. We do this here
149 because we want the browser warning to execute before spending the time
150 to download an app the user might not be able to use anyway.
151 -->
84 <script src="/juju-ui/assets/all-yui.js"></script>152 <script src="/juju-ui/assets/all-yui.js"></script>
85 <script src="/juju-ui/assets/modules.js"></script>153 <script src="/juju-ui/assets/modules.js"></script>
86 <script src="/juju-ui/assets/config.js"></script>154 <script src="/juju-ui/assets/config.js"></script>
87 <script>155 <script>
88 YUI(GlobalConfig).use(["juju-gui"], function(Y) {156 // Now that all of the above JS is loaded we can define the real start
89 app = new Y.juju.App(juju_config);157 // function which will be picked up by the setTimeout and the app will
90 // We need to activate the hotkeys when running the application158 // start.
91 // in production. Unit tests should call it manually.159 startTheApp = function() {
92 app.activateHotkeys();160 YUI(GlobalConfig).use(['juju-gui'], function(Y) {
93 });161 app = new Y.juju.App(juju_config);
162 // We need to activate the hotkeys when running the application
163 // in production. Unit tests should call it manually.
164 app.activateHotkeys();
165 });
166 };
167 // This call is here instead of in the "app-startup" script tag above
168 // because we extract that JS in order to test it. This bit here is just
169 // to bootstrap the app when actually loaded into a browser.
170 go();
94 </script>171 </script>
95 </body>172 </body>
96</html>173</html>
97174
=== modified file 'app/templates/login.handlebars'
--- app/templates/login.handlebars 2013-01-10 10:25:55 +0000
+++ app/templates/login.handlebars 2013-02-11 17:53:23 +0000
@@ -1,7 +1,7 @@
1<div id="login-column">1<div class="centered-column">
2 <i class="sprite juju_logo" title="Juju GUI"></i>2 <i class="sprite juju_logo" title="Juju GUI"></i>
3 <div id="login-form">3 <div id="login-form" class="panel">
4 <div id="login-header">4 <div class="header">
5 {{environment_name}} <span class="provider-type">{{provider_type}}</span>5 {{environment_name}} <span class="provider-type">{{provider_type}}</span>
6 </div>6 </div>
7 <form>7 <form>
88
=== modified file 'app/views/login.js'
--- app/views/login.js 2013-02-08 17:36:58 +0000
+++ app/views/login.js 2013-02-11 17:53:23 +0000
@@ -56,12 +56,12 @@
56 // In order to have the mask cover everything, it needs to be an56 // In order to have the mask cover everything, it needs to be an
57 // immediate child of the body. In order for it to render immediately57 // immediate child of the body. In order for it to render immediately
58 // when the app loads, it needs to be in index.html.58 // when the app loads, it needs to be in index.html.
59 var loginMask = Y.one('body > #login-mask');59 var mask = Y.one('body > #full-screen-mask');
60 if (!loginMask) {60 if (!mask) {
61 // No login mask in the DOM, as is the case in tests.61 // No mask in the DOM, as is the case in tests.
62 return this;62 return this;
63 }63 }
64 loginMask.show();64 mask.show();
65 var env = this.get('env');65 var env = this.get('env');
66 var environment_name_node = Y.one('#environment-name');66 var environment_name_node = Y.one('#environment-name');
67 var provider_type_node = Y.one('#provider-type');67 var provider_type_node = Y.one('#provider-type');
6868
=== modified file 'lib/merge-files.js'
--- lib/merge-files.js 2013-02-06 17:37:02 +0000
+++ lib/merge-files.js 2013-02-11 17:53:23 +0000
@@ -32,7 +32,7 @@
3232
33 // Combine one or more JavaScript files.33 // Combine one or more JavaScript files.
34 function combineJs(files, outputFile) {34 function combineJs(files, outputFile) {
35 var sourceMapName = syspath.basename(outputFile, '.js') + '-source-map';35 var sourceMapName = syspath.basename(outputFile) + '.map';
36 // We feed the minifier relative path names so the source map will map to36 // We feed the minifier relative path names so the source map will map to
37 // relative URLs that can be easily served.37 // relative URLs that can be easily served.
38 var relative_files = [];38 var relative_files = [];
@@ -45,6 +45,9 @@
45 outSourceMap: sourceMapName,45 outSourceMap: sourceMapName,
46 sourceRoot: 'source'46 sourceRoot: 'source'
47 });47 });
48 // The uglifyjs script does this instead of the library, so we have to do
49 // it ourselves since we are using uglify as a library and not a script.
50 result.code += '\n//@ sourceMappingURL=' + sourceMapName;
48 fs.writeFileSync(outputFile, result.code, 'utf8', throw_error);51 fs.writeFileSync(outputFile, result.code, 'utf8', throw_error);
49 fs.writeFileSync(sourceMapName, result.map, 'utf8', throw_error);52 fs.writeFileSync(sourceMapName, result.map, 'utf8', throw_error);
50 }53 }
5154
=== modified file 'lib/views/stylesheet.less'
--- lib/views/stylesheet.less 2013-02-07 19:04:00 +0000
+++ lib/views/stylesheet.less 2013-02-11 17:53:23 +0000
@@ -1414,7 +1414,7 @@
1414 }1414 }
1415}1415}
14161416
1417#login-mask {1417#full-screen-mask {
1418 display: block;1418 display: block;
1419 position: absolute;1419 position: absolute;
1420 top: 0;1420 top: 0;
@@ -1423,18 +1423,18 @@
1423 height: 100%;1423 height: 100%;
1424 z-index: 10000;1424 z-index: 10000;
1425}1425}
1426#login-column {1426.centered-column {
1427 display: block;1427 display: block;
1428 z-index: 10001;1428 z-index: 10001;
1429 position: absolute;1429 position: absolute;
1430 top: 80px;1430 top: 80px;
1431 left: 50%;1431 left: 50%;
1432 text-align: center;1432 text-align: center;
1433 width: 300px;1433 width: 400px;
1434 margin-left: -150px;1434 margin-left: -200px;
14351435
1436 div {1436 div {
1437 width: 220px;1437 width: 260px;
1438 text-align: left;1438 text-align: left;
1439 margin: 0 auto;1439 margin: 0 auto;
1440 margin-bottom: 1ex;1440 margin-bottom: 1ex;
@@ -1445,17 +1445,20 @@
1445 text-decoration: none1445 text-decoration: none
1446 }1446 }
1447 }1447 }
1448 @login-panel-color: #f5f5f5;1448
1449 @login-panel-gradient: (@login-panel-color - #111);1449 @panel-color: #f5f5f5;
1450 @login-panel-shadow: (@login-panel-color - #444);1450 @panel-gradient: (@panel-color - #111);
1451 @panel-shadow: (@panel-color - #444);
1451 @curve-radius: ~"24px 28px";1452 @curve-radius: ~"24px 28px";
1452 div#login-form {1453
1454 .panel {
1453 input {1455 input {
1456 width: 250px;
1454 margin-top: 8px;1457 margin-top: 8px;
1455 margin-bottom: 8px;1458 margin-bottom: 8px;
1456 }1459 }
1457 input[type=submit] {1460 input[type=submit] {
1458 width: 220px;1461 width: 260px;
1459 height: 26px;1462 height: 26px;
1460 text-transform: uppercase;1463 text-transform: uppercase;
1461 text-shadow: none;1464 text-shadow: none;
@@ -1474,12 +1477,10 @@
1474 padding: 5px 25px 5px;1477 padding: 5px 25px 5px;
1475 margin-top: 3ex;1478 margin-top: 3ex;
1476 margin-bottom: 4ex;1479 margin-bottom: 4ex;
1477 .create-button(@login-panel-color,1480 .create-button(@panel-color, @panel-gradient, @panel-shadow, -6px);
1478 @login-panel-gradient,1481 .create-border-radius(@curve-radius);
1479 @login-panel-shadow,1482
1480 -6px);1483 .header {
1481 .create-border-radius(~"24px / 28px");
1482 div#login-header {
1483 padding: 15px 25px 10px 25px;1484 padding: 15px 25px 10px 25px;
1484 margin-left: -25px;1485 margin-left: -25px;
1485 margin-top: -5px;1486 margin-top: -5px;
@@ -1489,8 +1490,8 @@
1489 -moz-border-radius-topright: @curve-radius;1490 -moz-border-radius-topright: @curve-radius;
1490 border-top-left-radius: @curve-radius;1491 border-top-left-radius: @curve-radius;
1491 border-top-right-radius: @curve-radius;1492 border-top-right-radius: @curve-radius;
1492 @gradient-start: @login-panel-gradient;1493 @gradient-start: @panel-gradient;
1493 @gradient-end: @login-panel-shadow;1494 @gradient-end: @panel-shadow;
1494 background-image: -ms-linear-gradient(1495 background-image: -ms-linear-gradient(
1495 top, @gradient-start, @gradient-end);1496 top, @gradient-start, @gradient-end);
1496 background-image: -webkit-gradient(1497 background-image: -webkit-gradient(
14971498
=== modified file 'test/index.html'
--- test/index.html 2013-02-07 16:40:46 +0000
+++ test/index.html 2013-02-11 17:53:23 +0000
@@ -28,6 +28,7 @@
2828
2929
30 <!-- Tests (Alphabetical)-->30 <!-- Tests (Alphabetical)-->
31 <script src="test_startup.js"></script>
31 <script src="test_app.js"></script>32 <script src="test_app.js"></script>
32 <script src="test_app_hotkeys.js"></script>33 <script src="test_app_hotkeys.js"></script>
33 <script src="test_application_notifications.js"></script>34 <script src="test_application_notifications.js"></script>
3435
=== modified file 'test/test_login.js'
--- test/test_login.js 2013-01-18 13:40:28 +0000
+++ test/test_login.js 2013-02-11 17:53:23 +0000
@@ -85,7 +85,7 @@
8585
86 describe('login view', function() {86 describe('login view', function() {
87 var requires = ['node', 'juju-gui', 'juju-views', 'juju-tests-utils'];87 var requires = ['node', 'juju-gui', 'juju-views', 'juju-tests-utils'];
88 var Y, conn, env, utils, juju, views, loginView, container, loginMask;88 var Y, conn, env, utils, juju, views, loginView, container, mask;
89 var test = it; // We aren't really doing BDD so let's be more direct.89 var test = it; // We aren't really doing BDD so let's be more direct.
9090
91 before(function(done) {91 before(function(done) {
@@ -104,7 +104,7 @@
104 conn.open();104 conn.open();
105 container = Y.one('body').appendChild('<div/>');105 container = Y.one('body').appendChild('<div/>');
106 // Needed by the render method.106 // Needed by the render method.
107 loginMask = Y.one('body').appendChild('<div/>').set('id', 'login-mask');107 mask = Y.one('body').appendChild('<div/>').set('id', 'full-screen-mask');
108 loginView = new views.login(108 loginView = new views.login(
109 {container: container, env: env, help_text: 'Help text'});109 {container: container, env: env, help_text: 'Help text'});
110 });110 });
@@ -112,7 +112,7 @@
112 afterEach(function() {112 afterEach(function() {
113 env.destroy();113 env.destroy();
114 container.remove(true);114 container.remove(true);
115 loginMask.remove(true);115 mask.remove(true);
116 });116 });
117117
118 test('the view login method logs in through the environment', function() {118 test('the view login method logs in through the environment', function() {
119119
=== added file 'test/test_startup.js.bottom'
--- test/test_startup.js.bottom 1970-01-01 00:00:00 +0000
+++ test/test_startup.js.bottom 2013-02-11 17:53:23 +0000
@@ -0,0 +1,50 @@
1 startTheApp = function() {
2 appStarted = true;
3 };
4 getDocument = function() {
5 return {
6 getElementById: function(id) {
7 assert.equal(id, 'browser-warning');
8 return {style: warningStyle};
9 }
10 };
11 };
12 });
13
14 it('knows that Chrome is supported', function() {
15 assert.isTrue(isBrowserSupported('Chrome'));
16 });
17
18 it('knows that Firefox is not supported', function() {
19 assert.isFalse(isBrowserSupported('Firefox'));
20 });
21
22 it('knows that IE is not supported', function() {
23 assert.isFalse(isBrowserSupported('MSIE'));
24 });
25
26 it('can display the browser warning', function() {
27 displayBrowserWarning();
28 assert.equal(warningStyle.display, 'block');
29 });
30
31 it('will hide the browser warning when the user continues', function() {
32 continueWithCurrentBrowser();
33 assert.equal(warningStyle.display, 'none');
34 });
35
36 it('will stop event propigation when the user continues', function() {
37 var result = continueWithCurrentBrowser();
38 // Since the function is an event handler of a submit button and we do
39 // not want the form submittion to actually happen, the handler must
40 // return false.
41 assert.isFalse(result);
42 });
43
44 it('will start the app when the user continues', function() {
45 continueWithCurrentBrowser();
46 assert.isTrue(appStarted);
47 });
48
49 });
50}) ();
051
=== added file 'test/test_startup.js.top'
--- test/test_startup.js.top 1970-01-01 00:00:00 +0000
+++ test/test_startup.js.top 2013-02-11 17:53:23 +0000
@@ -0,0 +1,10 @@
1'use strict';
2
3(function() {
4 describe('Application start-up', function() {
5 var startTheApp, isBrowserSupported, displayBrowserWarning,
6 continueWithCurrentBrowser, go, app, juju_config, getDocument,
7 appStarted, warningStyle;
8 before(function() {
9 warningStyle = {display: null};
10 appStarted = false;

Subscribers

People subscribed via source and target branches