whowish_word 0.6.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -2
- data/Gemfile +2 -4
- data/lib/whowish_word/action_controller/base.rb +6 -46
- data/lib/whowish_word/action_view/base.rb +18 -40
- data/lib/whowish_word/backends/defer_to_i18n.rb +18 -0
- data/lib/whowish_word/backends/flat_file_store.rb +75 -0
- data/lib/whowish_word/constant.rb +1 -3
- data/lib/whowish_word/initializer.rb +10 -29
- data/lib/whowish_word/rails/app/controllers/whowish_word_controller.rb +31 -85
- data/lib/whowish_word/whowish_word.rb +3 -6
- data/rails/Gemfile +2 -12
- data/rails/Gemfile.lock +30 -44
- data/rails/app/views/layouts/integration.html.erb +0 -1
- data/rails/config/application.rb +0 -17
- data/rails/config/boot.rb +0 -3
- data/rails/config/environment.rb +0 -9
- data/rails/config/routes.rb +0 -3
- data/rails/spec/controllers/whowish_word_controller_spec.rb +36 -10
- data/rails/spec/features/whowish_word_spec.rb +75 -0
- data/rails/spec/spec_helper.rb +15 -11
- data/rails/spec/support/browser_helper.rb +31 -0
- data/rails/spec/support/json_rspec_helper.rb +0 -3
- data/whowish_word.gemspec +4 -4
- metadata +24 -48
- data/lib/whowish_word/action_mailer/base.rb +0 -7
- data/lib/whowish_word/action_view/template.rb +0 -31
- data/lib/whowish_word/authentication.rb +0 -14
- data/lib/whowish_word/db_migration/active_record/whowish_word_html.rb +0 -15
- data/lib/whowish_word/db_migration/mongoid/whowish_word_html.rb +0 -6
- data/lib/whowish_word/rails/app/models/active_record/whowish_word_html.rb +0 -4
- data/lib/whowish_word/rails/app/models/mongoid/whowish_word_html.rb +0 -9
- data/lib/whowish_word/word_for.rb +0 -94
- data/rails/app/assets/javascripts/home2.js +0 -2
- data/rails/app/assets/javascripts/integration.js +0 -2
- data/rails/app/assets/javascripts/test_javascript.js +0 -2
- data/rails/app/assets/javascripts/test_word_for.js +0 -2
- data/rails/app/assets/stylesheets/home2.css +0 -4
- data/rails/app/assets/stylesheets/integration.css +0 -4
- data/rails/app/assets/stylesheets/test_javascript.css +0 -4
- data/rails/app/assets/stylesheets/test_word_for.css +0 -4
- data/rails/app/controllers/home2_controller.rb +0 -2
- data/rails/app/controllers/test_javascript_controller.rb +0 -11
- data/rails/app/controllers/test_word_for_controller.rb +0 -5
- data/rails/app/helpers/home2_helper.rb +0 -2
- data/rails/app/helpers/test_javascript_helper.rb +0 -2
- data/rails/app/helpers/test_word_for_helper.rb +0 -2
- data/rails/app/views/home2/index.html.erb +0 -2
- data/rails/app/views/home2/test.html.erb +0 -3
- data/rails/app/views/test_javascript/change_value.html.erb +0 -32
- data/rails/app/views/test_javascript/index.html.erb +0 -87
- data/rails/app/views/test_javascript/replace_with_html.html.erb +0 -96
- data/rails/app/views/test_word_for/_partial.html.erb +0 -5
- data/rails/app/views/test_word_for/index.html.erb +0 -9
- data/rails/config/database.yml +0 -25
- data/rails/config/mongoid.rb +0 -6
- data/rails/config/mongoid.yml +0 -14
- data/rails/db/.gitdummy +0 -0
- data/rails/mongo.bat +0 -5
- data/rails/public/jasmine/MIT.LICENSE +0 -20
- data/rails/public/jasmine/jasmine-html.js +0 -190
- data/rails/public/jasmine/jasmine.css +0 -166
- data/rails/public/jasmine/jasmine.js +0 -2476
- data/rails/public/jasmine/jasmine_favicon.png +0 -0
- data/rails/public/javascripts/jquery.loading_button.js +0 -72
- data/rails/public/sinonjs/sinonjs.js +0 -2821
- data/rails/public/test/jquery_version.html +0 -26
- data/rails/spec/integration/whowish_word_spec.rb +0 -102
- data/rails/spec/support/browser.rb +0 -194
- data/spec/spec_helper.rb +0 -19
@@ -1,32 +0,0 @@
|
|
1
|
-
<span style="width:600px;">
|
2
|
-
<p>This page tests changing value of a textbox and a textarea to some constant before running WhowishWord.</p>
|
3
|
-
|
4
|
-
<p>
|
5
|
-
I have found out that changing value through Javascript does not actually change the value of the attribute 'value'.
|
6
|
-
</p>
|
7
|
-
|
8
|
-
<p>
|
9
|
-
This causes problem in the previous version because it detects that the attribute 'value' needs a WhowishWord, but
|
10
|
-
when the value of the element is retrieved, it does not conform with WhowishWord edit format.
|
11
|
-
</p>
|
12
|
-
|
13
|
-
<p>
|
14
|
-
So, <i>WhowishWordElementCreator</i> explicitly exclude the attribute 'value'
|
15
|
-
and let <i>WhowishWordValueCreator</i> deals with it.<br/>
|
16
|
-
</p>
|
17
|
-
</span>
|
18
|
-
<span>
|
19
|
-
<b>Textbox: </b> <input type="textbox" id="change_textbox"
|
20
|
-
title="__whowishWord_______title_textbox|name,value_____title"
|
21
|
-
value="__whowishWord_______value_textbox|name,value_____value"
|
22
|
-
placeholder="__whowishWord_______placeholder_textbox|name,value_____placeholder">
|
23
|
-
</span>
|
24
|
-
<span>
|
25
|
-
<b>Textarea: </b> <textarea id="change_textarea"
|
26
|
-
title="__whowishWord_______title_textarea|name,value_____title"
|
27
|
-
placeholder="__whowishWord_______placeholder_textarea|name,value_____placeholder">__whowishWord_______value_textarea|name,value_____value</textarea>
|
28
|
-
</span>
|
29
|
-
<script type="text/javascript">
|
30
|
-
$('#change_textbox').val("something else");
|
31
|
-
$('#change_textarea').val("something other than this");
|
32
|
-
</script>
|
@@ -1,87 +0,0 @@
|
|
1
|
-
<span style="width:600px;">
|
2
|
-
<p>This is the page that tests every element.</p>
|
3
|
-
</span>
|
4
|
-
<span>
|
5
|
-
<b>Text: </b> <dfn>__whowishWord_______text_text|name,value_____text</dfn>
|
6
|
-
</span>
|
7
|
-
<span>
|
8
|
-
<b>Bullet: </b> <ul>
|
9
|
-
<li><dfn>__whowishWord_______text_text|name,value_____text</dfn></li>
|
10
|
-
<li><dfn>__whowishWord_______text_text|name,value_____text</dfn></li>
|
11
|
-
</ul>
|
12
|
-
</span>
|
13
|
-
<span>
|
14
|
-
<b>Anchor: </b> <a href="#"><dfn>__whowishWord_______text_text|name,value_____text</dfn></a>
|
15
|
-
</span>
|
16
|
-
<span>
|
17
|
-
<b>Label: </b> <label for="some_textbox">__whowishWord_______text_label|name,value_____text</label>
|
18
|
-
<input type="text" name="some_textbox">
|
19
|
-
</span>
|
20
|
-
<span>
|
21
|
-
<b>Textbox: </b> <input type="textbox"
|
22
|
-
title="__whowishWord_______title_textbox|name,value_____title"
|
23
|
-
value="__whowishWord_______value_textbox|name,value_____value"
|
24
|
-
placeholder="__whowishWord_______placeholder_textbox|name,value_____placeholder">
|
25
|
-
</span>
|
26
|
-
<span>
|
27
|
-
<b>Textarea: </b> <textarea
|
28
|
-
title="__whowishWord_______title_textarea|name,value_____title"
|
29
|
-
placeholder="__whowishWord_______placeholder_textarea|name,value_____placeholder">__whowishWord_______value_textarea|name,value_____value</textarea>
|
30
|
-
</span>
|
31
|
-
<span>
|
32
|
-
<b>Checkbox: </b> <input type="checkbox"
|
33
|
-
title="__whowishWord_______title_checkbox|name,value_____title"
|
34
|
-
value="__whowishWord_______value_checkbox|name,value_____value">
|
35
|
-
</span>
|
36
|
-
<span>
|
37
|
-
<b>Radio: </b> <input type="radio"
|
38
|
-
title="__whowishWord_______title_radio|name,value_____title"
|
39
|
-
value="__whowishWord_______value_radio|name,value_____value">
|
40
|
-
</span>
|
41
|
-
<span>
|
42
|
-
<b>Select: </b> <select title="__whowishWord_______title_select|name,value_____title">
|
43
|
-
<option value="__whowishWord_______option_value_0|name,value_____value_0">__whowishWord_______option_text_0_____text_0</option>
|
44
|
-
<option value="__whowishWord_______option_value_1|name,value_____value_1">__whowishWord_______option_text_1_____text_1</option>
|
45
|
-
</select>
|
46
|
-
</span>
|
47
|
-
<span>
|
48
|
-
<b>Button(Input): </b> <input type="button"
|
49
|
-
title="__whowishWord_______title_input_button|name,value_____title"
|
50
|
-
value="__whowishWord_______value_input_button|name,value_____value" >
|
51
|
-
</span>
|
52
|
-
<span>
|
53
|
-
<b>Submit(Input): </b> <input type="submit"
|
54
|
-
title="__whowishWord_______title_input_submit|name,value_____title"
|
55
|
-
value="__whowishWord_______value_input_submit|name,value_____value" >
|
56
|
-
</span>
|
57
|
-
<span>
|
58
|
-
<b>Button: </b> <button title="__whowishWord_______title_button|name,value_____title">__whowishWord_______value_button|name,value_____value</button>
|
59
|
-
</span>
|
60
|
-
<span>
|
61
|
-
<b>Late Text: </b> <span id="late_text"></span>
|
62
|
-
|
63
|
-
<script type="text/javascript">
|
64
|
-
|
65
|
-
setTimeout(function() {
|
66
|
-
$('#late_text').html("<dfn>__whowishWord_______text_late_text|name,value_____text</dfn>");
|
67
|
-
},5000);
|
68
|
-
|
69
|
-
</script>
|
70
|
-
</span>
|
71
|
-
<span>
|
72
|
-
<b>Late Textbox: </b> <input type="textbox" id="late_textbox"
|
73
|
-
title="title"
|
74
|
-
value="value"
|
75
|
-
placeholder="placeholder">
|
76
|
-
|
77
|
-
<script type="text/javascript">
|
78
|
-
|
79
|
-
setTimeout(function() {
|
80
|
-
$('#late_textbox').attr("title","__whowishWord_______title_late_textbox|name,value_____title");
|
81
|
-
$('#late_textbox').attr("value","__whowishWord_______value_late_textbox|name,value_____value");
|
82
|
-
$('#late_textbox').attr("placeholder","__whowishWord_______placeholder_late_textbox|name,value_____placeholder");
|
83
|
-
},5000);
|
84
|
-
|
85
|
-
</script>
|
86
|
-
</span>
|
87
|
-
|
@@ -1,96 +0,0 @@
|
|
1
|
-
<span style="width:600px;">
|
2
|
-
<p>This page tests replacing, hiding and showing content with raw html.</p>
|
3
|
-
|
4
|
-
<p>
|
5
|
-
I have found that if we move content by raw html, some variables bound with the element will be deleted.
|
6
|
-
This is because the elements are deleted and recreated.
|
7
|
-
|
8
|
-
WhowishWord solves that problem by storing all needed data in its hash instead with the element's id as a key.
|
9
|
-
</p>
|
10
|
-
|
11
|
-
</span>
|
12
|
-
<div id="all_elements">
|
13
|
-
<span>
|
14
|
-
<b>Text: </b> <dfn>__whowishWord_______text_text|name,value_____text</dfn>
|
15
|
-
</span>
|
16
|
-
<span>
|
17
|
-
<b>Label: </b> <label for="some_textbox">__whowishWord_______text_label|name,value_____text</label>
|
18
|
-
<input type="text" name="some_textbox">
|
19
|
-
</span>
|
20
|
-
<span>
|
21
|
-
<b>Textbox: </b> <input type="textbox"
|
22
|
-
title="__whowishWord_______title_textbox|name,value_____title"
|
23
|
-
value="__whowishWord_______value_textbox|name,value_____value"
|
24
|
-
placeholder="__whowishWord_______placeholder_textbox|name,value_____placeholder">
|
25
|
-
</span>
|
26
|
-
<span>
|
27
|
-
<b>Textarea: </b> <textarea
|
28
|
-
title="__whowishWord_______title_textarea|name,value_____title"
|
29
|
-
placeholder="__whowishWord_______placeholder_textarea|name,value_____placeholder">__whowishWord_______value_textarea|name,value_____value</textarea>
|
30
|
-
</span>
|
31
|
-
<span>
|
32
|
-
<b>Checkbox: </b> <input type="checkbox"
|
33
|
-
title="__whowishWord_______title_checkbox|name,value_____title"
|
34
|
-
value="__whowishWord_______value_checkbox|name,value_____value">
|
35
|
-
</span>
|
36
|
-
<span>
|
37
|
-
<b>Radio: </b> <input type="radio"
|
38
|
-
title="__whowishWord_______title_radio|name,value_____title"
|
39
|
-
value="__whowishWord_______value_radio|name,value_____value">
|
40
|
-
</span>
|
41
|
-
<span>
|
42
|
-
<b>Select: </b> <select title="__whowishWord_______title_select|name,value_____title">
|
43
|
-
<option value="__whowishWord_______option_value_0|name,value_____value_0">__whowishWord_______option_text_0_____text_0</option>
|
44
|
-
<option value="__whowishWord_______option_value_1|name,value_____value_1">__whowishWord_______option_text_1_____text_1</option>
|
45
|
-
</select>
|
46
|
-
</span>
|
47
|
-
<span>
|
48
|
-
<b>Button(Input): </b> <input type="button"
|
49
|
-
title="__whowishWord_______title_input_button|name,value_____title"
|
50
|
-
value="__whowishWord_______value_input_button|name,value_____value" >
|
51
|
-
</span>
|
52
|
-
<span>
|
53
|
-
<b>Submit(Input): </b> <input type="submit"
|
54
|
-
title="__whowishWord_______title_input_submit|name,value_____title"
|
55
|
-
value="__whowishWord_______value_input_submit|name,value_____value" >
|
56
|
-
</span>
|
57
|
-
<span>
|
58
|
-
<b>Button: </b> <button title="__whowishWord_______title_button|name,value_____title">__whowishWord_______value_button|name,value_____value</button>
|
59
|
-
</span>
|
60
|
-
<span>
|
61
|
-
<b>Late Text: </b> <span id="late_text"></span>
|
62
|
-
|
63
|
-
<script type="text/javascript">
|
64
|
-
|
65
|
-
setTimeout(function() {
|
66
|
-
$('#late_text').html("<dfn>__whowishWord_______text_late_text|name,value_____text</dfn>");
|
67
|
-
},5000);
|
68
|
-
|
69
|
-
</script>
|
70
|
-
</span>
|
71
|
-
<span>
|
72
|
-
<b>Late Textbox: </b> <input type="textbox" id="late_textbox"
|
73
|
-
title="title"
|
74
|
-
value="value"
|
75
|
-
placeholder="placeholder">
|
76
|
-
|
77
|
-
<script type="text/javascript">
|
78
|
-
|
79
|
-
setTimeout(function() {
|
80
|
-
$('#late_textbox').attr("title","__whowishWord_______title_late_textbox|name,value_____title");
|
81
|
-
$('#late_textbox').attr("value","__whowishWord_______value_late_textbox|name,value_____value");
|
82
|
-
$('#late_textbox').attr("placeholder","__whowishWord_______placeholder_late_textbox|name,value_____placeholder");
|
83
|
-
},5000);
|
84
|
-
|
85
|
-
</script>
|
86
|
-
</span>
|
87
|
-
</div><br/>
|
88
|
-
<input type="button" value="Replace all contents" onclick="replace_all_content();">
|
89
|
-
<script type="text/javascript">
|
90
|
-
function replace_all_content() {
|
91
|
-
$('#all_elements').html($('#all_elements').html());
|
92
|
-
}
|
93
|
-
</script>
|
94
|
-
|
95
|
-
|
96
|
-
|
@@ -1,5 +0,0 @@
|
|
1
|
-
<span id="partial"><%= word_for :text%></span>
|
2
|
-
<span id="partial_attr"><%= word_for_attr :text%></span>
|
3
|
-
|
4
|
-
<span id="partial_with_variables"><%= word_for :text, :number=>5, :name=>"tanin" %></span>
|
5
|
-
<span id="partial_attr_with_variables"><%= word_for_attr :text, :number=>5, :name=>"tanin"%></span>
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<span id="view_before_partial"><%= word_for :text%></span>
|
2
|
-
|
3
|
-
<%= render :partial=>"partial"%>
|
4
|
-
|
5
|
-
<span id="view"><%= word_for :text%></span>
|
6
|
-
<span id="view_attr"><%= word_for_attr :text%></span>
|
7
|
-
|
8
|
-
<span id="view_with_variables"><%= word_for :text, :number=>5, :name=>"tanin" %></span>
|
9
|
-
<span id="view_attr_with_variables"><%= word_for_attr :text, :number=>5, :name=>"tanin"%></span>
|
data/rails/config/database.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3
|
3
|
-
#
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
-
# gem 'sqlite3'
|
6
|
-
development:
|
7
|
-
adapter: sqlite3
|
8
|
-
database: db/development.sqlite3
|
9
|
-
pool: 5
|
10
|
-
timeout: 5000
|
11
|
-
|
12
|
-
# Warning: The database defined as "test" will be erased and
|
13
|
-
# re-generated from your development database when you run "rake".
|
14
|
-
# Do not set this db to the same as development or production.
|
15
|
-
test:
|
16
|
-
adapter: sqlite3
|
17
|
-
database: db/test.sqlite3
|
18
|
-
pool: 5
|
19
|
-
timeout: 5000
|
20
|
-
|
21
|
-
production:
|
22
|
-
adapter: sqlite3
|
23
|
-
database: db/production.sqlite3
|
24
|
-
pool: 5
|
25
|
-
timeout: 5000
|
data/rails/config/mongoid.rb
DELETED
data/rails/config/mongoid.yml
DELETED
data/rails/db/.gitdummy
DELETED
File without changes
|
data/rails/mongo.bat
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2008-2011 Pivotal Labs
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,190 +0,0 @@
|
|
1
|
-
jasmine.TrivialReporter = function(doc) {
|
2
|
-
this.document = doc || document;
|
3
|
-
this.suiteDivs = {};
|
4
|
-
this.logRunningSpecs = false;
|
5
|
-
};
|
6
|
-
|
7
|
-
jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
|
8
|
-
var el = document.createElement(type);
|
9
|
-
|
10
|
-
for (var i = 2; i < arguments.length; i++) {
|
11
|
-
var child = arguments[i];
|
12
|
-
|
13
|
-
if (typeof child === 'string') {
|
14
|
-
el.appendChild(document.createTextNode(child));
|
15
|
-
} else {
|
16
|
-
if (child) { el.appendChild(child); }
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
|
-
for (var attr in attrs) {
|
21
|
-
if (attr == "className") {
|
22
|
-
el[attr] = attrs[attr];
|
23
|
-
} else {
|
24
|
-
el.setAttribute(attr, attrs[attr]);
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
return el;
|
29
|
-
};
|
30
|
-
|
31
|
-
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
32
|
-
var showPassed, showSkipped;
|
33
|
-
|
34
|
-
this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
|
35
|
-
this.createDom('div', { className: 'banner' },
|
36
|
-
this.createDom('div', { className: 'logo' },
|
37
|
-
this.createDom('span', { className: 'title' }, "Jasmine"),
|
38
|
-
this.createDom('span', { className: 'version' }, runner.env.versionString())),
|
39
|
-
this.createDom('div', { className: 'options' },
|
40
|
-
"Show ",
|
41
|
-
showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
|
42
|
-
this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
|
43
|
-
showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
|
44
|
-
this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
|
45
|
-
)
|
46
|
-
),
|
47
|
-
|
48
|
-
this.runnerDiv = this.createDom('div', { className: 'runner running' },
|
49
|
-
this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
|
50
|
-
this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
|
51
|
-
this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
|
52
|
-
);
|
53
|
-
|
54
|
-
this.document.body.appendChild(this.outerDiv);
|
55
|
-
|
56
|
-
var suites = runner.suites();
|
57
|
-
for (var i = 0; i < suites.length; i++) {
|
58
|
-
var suite = suites[i];
|
59
|
-
var suiteDiv = this.createDom('div', { className: 'suite' },
|
60
|
-
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
|
61
|
-
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
|
62
|
-
this.suiteDivs[suite.id] = suiteDiv;
|
63
|
-
var parentDiv = this.outerDiv;
|
64
|
-
if (suite.parentSuite) {
|
65
|
-
parentDiv = this.suiteDivs[suite.parentSuite.id];
|
66
|
-
}
|
67
|
-
parentDiv.appendChild(suiteDiv);
|
68
|
-
}
|
69
|
-
|
70
|
-
this.startedAt = new Date();
|
71
|
-
|
72
|
-
var self = this;
|
73
|
-
showPassed.onclick = function(evt) {
|
74
|
-
if (showPassed.checked) {
|
75
|
-
self.outerDiv.className += ' show-passed';
|
76
|
-
} else {
|
77
|
-
self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
|
78
|
-
}
|
79
|
-
};
|
80
|
-
|
81
|
-
showSkipped.onclick = function(evt) {
|
82
|
-
if (showSkipped.checked) {
|
83
|
-
self.outerDiv.className += ' show-skipped';
|
84
|
-
} else {
|
85
|
-
self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
|
86
|
-
}
|
87
|
-
};
|
88
|
-
};
|
89
|
-
|
90
|
-
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
|
91
|
-
var results = runner.results();
|
92
|
-
var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
|
93
|
-
this.runnerDiv.setAttribute("class", className);
|
94
|
-
//do it twice for IE
|
95
|
-
this.runnerDiv.setAttribute("className", className);
|
96
|
-
var specs = runner.specs();
|
97
|
-
var specCount = 0;
|
98
|
-
for (var i = 0; i < specs.length; i++) {
|
99
|
-
if (this.specFilter(specs[i])) {
|
100
|
-
specCount++;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
|
104
|
-
message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
|
105
|
-
this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
|
106
|
-
|
107
|
-
this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
|
108
|
-
};
|
109
|
-
|
110
|
-
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
111
|
-
var results = suite.results();
|
112
|
-
var status = results.passed() ? 'passed' : 'failed';
|
113
|
-
if (results.totalCount === 0) { // todo: change this to check results.skipped
|
114
|
-
status = 'skipped';
|
115
|
-
}
|
116
|
-
this.suiteDivs[suite.id].className += " " + status;
|
117
|
-
};
|
118
|
-
|
119
|
-
jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
|
120
|
-
if (this.logRunningSpecs) {
|
121
|
-
this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
|
122
|
-
}
|
123
|
-
};
|
124
|
-
|
125
|
-
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
126
|
-
var results = spec.results();
|
127
|
-
var status = results.passed() ? 'passed' : 'failed';
|
128
|
-
if (results.skipped) {
|
129
|
-
status = 'skipped';
|
130
|
-
}
|
131
|
-
var specDiv = this.createDom('div', { className: 'spec ' + status },
|
132
|
-
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
|
133
|
-
this.createDom('a', {
|
134
|
-
className: 'description',
|
135
|
-
href: '?spec=' + encodeURIComponent(spec.getFullName()),
|
136
|
-
title: spec.getFullName()
|
137
|
-
}, spec.description));
|
138
|
-
|
139
|
-
|
140
|
-
var resultItems = results.getItems();
|
141
|
-
var messagesDiv = this.createDom('div', { className: 'messages' });
|
142
|
-
for (var i = 0; i < resultItems.length; i++) {
|
143
|
-
var result = resultItems[i];
|
144
|
-
|
145
|
-
if (result.type == 'log') {
|
146
|
-
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
|
147
|
-
} else if (result.type == 'expect' && result.passed && !result.passed()) {
|
148
|
-
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
|
149
|
-
|
150
|
-
if (result.trace.stack) {
|
151
|
-
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
|
152
|
-
}
|
153
|
-
}
|
154
|
-
}
|
155
|
-
|
156
|
-
if (messagesDiv.childNodes.length > 0) {
|
157
|
-
specDiv.appendChild(messagesDiv);
|
158
|
-
}
|
159
|
-
|
160
|
-
this.suiteDivs[spec.suite.id].appendChild(specDiv);
|
161
|
-
};
|
162
|
-
|
163
|
-
jasmine.TrivialReporter.prototype.log = function() {
|
164
|
-
var console = jasmine.getGlobal().console;
|
165
|
-
if (console && console.log) {
|
166
|
-
if (console.log.apply) {
|
167
|
-
console.log.apply(console, arguments);
|
168
|
-
} else {
|
169
|
-
console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
|
170
|
-
}
|
171
|
-
}
|
172
|
-
};
|
173
|
-
|
174
|
-
jasmine.TrivialReporter.prototype.getLocation = function() {
|
175
|
-
return this.document.location;
|
176
|
-
};
|
177
|
-
|
178
|
-
jasmine.TrivialReporter.prototype.specFilter = function(spec) {
|
179
|
-
var paramMap = {};
|
180
|
-
var params = this.getLocation().search.substring(1).split('&');
|
181
|
-
for (var i = 0; i < params.length; i++) {
|
182
|
-
var p = params[i].split('=');
|
183
|
-
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
|
184
|
-
}
|
185
|
-
|
186
|
-
if (!paramMap.spec) {
|
187
|
-
return true;
|
188
|
-
}
|
189
|
-
return spec.getFullName().indexOf(paramMap.spec) === 0;
|
190
|
-
};
|