Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(440)

Delta Between Two Patch Sets: test/test_startup.js.bottom

Issue 7314082: Add a loading messages and animation.
Left Patch Set: Add a loading animation. Created 11 years, 1 month ago
Right Patch Set: Add a loading messages and animation. Created 11 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « test/index.html ('k') | test/test_startup.js.top » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 originalStartTheApp = startTheApp; 1 // Replace the real app starting function with one that is more suitable
2 // for testing.
2 startTheApp = function() { 3 startTheApp = function() {
3 appStarted = true; 4 appStarted = true;
4 // The behavior of the startTheApp function of displaying the loding
gary.poster 2013/02/12 21:55:40 loading
bac 2013/02/12 21:56:31 typo: loading
5 // message is emulated here, but the real startTheApp funciton is
bac 2013/02/12 21:56:31 typo: function
6 // tested below to ensure that it actually behaves this way.
7 displayLoadingMessage();
8 }; 5 };
6
9 getDocument = function() { 7 getDocument = function() {
10 return { 8 return {
11 getElementById: function(id) { 9 getElementById: function(id) {
12 if (id === 'browser-warning') { 10 if (id === 'browser-warning') {
13 return {style: warningStyle}; 11 return {style: warningStyle};
14 } else if (id === 'loading-message') { 12 } else if (id === 'loading-message') {
15 return {style: loadingStyle}; 13 return {style: loadingStyle};
16 } else if (id === 'loading-spinner') { 14 } else if (id === 'loading-spinner') {
17 return {}; 15 return {};
18 } else { 16 } else {
(...skipping 22 matching lines...) Expand all
41 assert.isNull(loadingStyle.display); 39 assert.isNull(loadingStyle.display);
42 displayBrowserWarning(); 40 displayBrowserWarning();
43 assert.equal(warningStyle.display, 'block'); 41 assert.equal(warningStyle.display, 'block');
44 }); 42 });
45 43
46 it('will hide the browser warning when the user continues', function() { 44 it('will hide the browser warning when the user continues', function() {
47 continueWithCurrentBrowser(); 45 continueWithCurrentBrowser();
48 assert.equal(warningStyle.display, 'none'); 46 assert.equal(warningStyle.display, 'none');
49 }); 47 });
50 48
49 it('will display the loading message when the user continues', function() {
50 continueWithCurrentBrowser();
51 assert.equal(loadingStyle.display, 'block');
52 });
53
51 it('will stop event propigation when the user continues', function() { 54 it('will stop event propigation when the user continues', function() {
52 var result = continueWithCurrentBrowser(); 55 var result = continueWithCurrentBrowser();
53 // Since the function is an event handler of a submit button and we do 56 // Since the function is an event handler of a submit button and we do
54 // not want the form submittion to actually happen, the handler must 57 // not want the form submittion to actually happen, the handler must
55 // return false. 58 // return false.
56 assert.isFalse(result); 59 assert.isFalse(result);
57 }); 60 });
58 61
59 it('will start the app when the user continues', function() { 62 it('will start the app when the user continues', function() {
60 continueWithCurrentBrowser(); 63 continueWithCurrentBrowser();
61 assert.isTrue(appStarted); 64 assert.isTrue(appStarted);
62 }); 65 });
63 66
64 it('will show a loading message while the app loads', function() {
65 // The loading message has not had it's default style touched yet.
bac 2013/02/12 21:56:31 typo: its
66 assert.isNull(loadingStyle.display);
67 // The "go" function displays the loading message if there is no
68 // browser compatability warning.
69 go('Chrome');
70 assert.equal(loadingStyle.display, 'block');
71 assert.isNull(warningStyle.display);
72 });
73
74 it('will show a loading message after any browser wanting', function() { 67 it('will show a loading message after any browser wanting', function() {
bac 2013/02/12 21:56:31 wanting? did you mean 'waiting'? otherwise i don
75 // If the browser is not supported, then the loading message will be 68 // If the browser is not supported, then the loading message will be
76 // displayed after the browser warning. 69 // displayed after the browser warning.
77 go('Browser that does not exist, and therefore is not supported'); 70 go('Browser that does not exist, and therefore is not supported');
gary.poster 2013/02/12 21:55:40 heh :-)
78 assert.equal(warningStyle.display, 'block'); 71 assert.equal(warningStyle.display, 'block');
79 assert.isNull(loadingStyle.display); 72 assert.equal(loadingStyle.display, 'none');
80 continueWithCurrentBrowser(); 73 continueWithCurrentBrowser();
81 assert.equal(warningStyle.display, 'none'); 74 assert.equal(warningStyle.display, 'none');
82 assert.equal(loadingStyle.display, 'block'); 75 assert.equal(loadingStyle.display, 'block');
83 }); 76 });
84 77
85 }); 78 });
86 }) (); 79 }) ();
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b