i18n-js 3.9.2 → 4.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +4 -0
  3. data/.github/FUNDING.yml +1 -1
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
  5. data/.github/ISSUE_TEMPLATE/config.yml +5 -0
  6. data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  7. data/.github/PULL_REQUEST_TEMPLATE.md +38 -0
  8. data/.github/dependabot.yml +15 -0
  9. data/.github/workflows/ruby-tests.yml +73 -0
  10. data/.gitignore +13 -7
  11. data/.rubocop.yml +19 -0
  12. data/CHANGELOG.md +45 -561
  13. data/CODE_OF_CONDUCT.md +74 -0
  14. data/CONTRIBUTING.md +79 -0
  15. data/Gemfile +3 -0
  16. data/LICENSE.md +20 -0
  17. data/MIGRATING_FROM_V3_TO_V4.md +191 -0
  18. data/README.md +425 -951
  19. data/Rakefile +10 -20
  20. data/bin/release +81 -0
  21. data/exe/i18n +5 -0
  22. data/i18n-js.gemspec +51 -29
  23. data/lib/guard/i18n-js/templates/Guardfile +10 -0
  24. data/lib/guard/i18n-js/version.rb +13 -0
  25. data/lib/guard/i18n-js.rb +95 -0
  26. data/lib/i18n-js/clean_hash.rb +13 -0
  27. data/lib/i18n-js/cli/check_command.rb +17 -0
  28. data/lib/i18n-js/cli/command.rb +79 -0
  29. data/lib/i18n-js/cli/export_command.rb +95 -0
  30. data/lib/i18n-js/cli/init_command.rb +52 -0
  31. data/lib/i18n-js/cli/lint_scripts_command.rb +157 -0
  32. data/lib/i18n-js/cli/lint_translations_command.rb +155 -0
  33. data/lib/i18n-js/cli/plugins_command.rb +67 -0
  34. data/lib/i18n-js/cli/ui.rb +64 -0
  35. data/lib/i18n-js/cli/version_command.rb +18 -0
  36. data/lib/i18n-js/cli.rb +66 -0
  37. data/lib/i18n-js/embed_fallback_translations_plugin.rb +70 -0
  38. data/lib/i18n-js/export_files_plugin.rb +103 -0
  39. data/lib/i18n-js/lint.js +150645 -0
  40. data/lib/i18n-js/lint.ts +196 -0
  41. data/lib/i18n-js/listen.rb +96 -0
  42. data/lib/i18n-js/plugin.rb +103 -0
  43. data/lib/i18n-js/schema.rb +216 -0
  44. data/lib/i18n-js/sort_hash.rb +12 -0
  45. data/lib/i18n-js/version.rb +5 -0
  46. data/lib/i18n-js.rb +107 -1
  47. data/package.json +5 -20
  48. metadata +152 -198
  49. data/.editorconfig +0 -24
  50. data/.github/workflows/tests.yaml +0 -106
  51. data/.npmignore +0 -27
  52. data/Appraisals +0 -52
  53. data/app/assets/javascripts/i18n/filtered.js.erb +0 -23
  54. data/app/assets/javascripts/i18n/shims.js +0 -240
  55. data/app/assets/javascripts/i18n/translations.js +0 -3
  56. data/app/assets/javascripts/i18n.js +0 -1095
  57. data/gemfiles/i18n_0_6.gemfile +0 -7
  58. data/gemfiles/i18n_0_7.gemfile +0 -7
  59. data/gemfiles/i18n_0_8.gemfile +0 -7
  60. data/gemfiles/i18n_0_9.gemfile +0 -7
  61. data/gemfiles/i18n_1_0.gemfile +0 -7
  62. data/gemfiles/i18n_1_1.gemfile +0 -7
  63. data/gemfiles/i18n_1_10.gemfile +0 -7
  64. data/gemfiles/i18n_1_2.gemfile +0 -7
  65. data/gemfiles/i18n_1_3.gemfile +0 -7
  66. data/gemfiles/i18n_1_4.gemfile +0 -7
  67. data/gemfiles/i18n_1_5.gemfile +0 -7
  68. data/gemfiles/i18n_1_6.gemfile +0 -7
  69. data/gemfiles/i18n_1_7.gemfile +0 -7
  70. data/gemfiles/i18n_1_8.gemfile +0 -7
  71. data/gemfiles/i18n_1_9.gemfile +0 -7
  72. data/i18njs.png +0 -0
  73. data/lib/i18n/js/dependencies.rb +0 -67
  74. data/lib/i18n/js/engine.rb +0 -87
  75. data/lib/i18n/js/fallback_locales.rb +0 -70
  76. data/lib/i18n/js/formatters/base.rb +0 -25
  77. data/lib/i18n/js/formatters/js.rb +0 -39
  78. data/lib/i18n/js/formatters/json.rb +0 -13
  79. data/lib/i18n/js/middleware.rb +0 -82
  80. data/lib/i18n/js/private/config_store.rb +0 -31
  81. data/lib/i18n/js/private/hash_with_symbol_keys.rb +0 -36
  82. data/lib/i18n/js/segment.rb +0 -81
  83. data/lib/i18n/js/utils.rb +0 -91
  84. data/lib/i18n/js/version.rb +0 -7
  85. data/lib/i18n/js.rb +0 -274
  86. data/lib/rails/generators/i18n/js/config/config_generator.rb +0 -19
  87. data/lib/rails/generators/i18n/js/config/templates/i18n-js.yml +0 -27
  88. data/lib/tasks/export.rake +0 -8
  89. data/spec/fixtures/custom_path.yml +0 -5
  90. data/spec/fixtures/default.yml +0 -5
  91. data/spec/fixtures/erb.yml +0 -5
  92. data/spec/fixtures/except_condition.yml +0 -7
  93. data/spec/fixtures/js_available_locales_custom.yml +0 -1
  94. data/spec/fixtures/js_export_dir_custom.yml +0 -7
  95. data/spec/fixtures/js_export_dir_none.yml +0 -6
  96. data/spec/fixtures/js_extend_parent.yml +0 -6
  97. data/spec/fixtures/js_extend_segment.yml +0 -6
  98. data/spec/fixtures/js_file_per_locale.yml +0 -7
  99. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_default_locale_symbol.yml +0 -4
  100. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_hash.yml +0 -6
  101. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale.yml +0 -4
  102. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale_without_fallback_translations.yml +0 -4
  103. data/spec/fixtures/js_file_per_locale_with_fallbacks_enabled.yml +0 -4
  104. data/spec/fixtures/js_file_per_locale_without_fallbacks.yml +0 -4
  105. data/spec/fixtures/js_file_with_namespace_prefix_and_pretty_print.yml +0 -9
  106. data/spec/fixtures/js_sort_translation_keys_false.yml +0 -6
  107. data/spec/fixtures/js_sort_translation_keys_true.yml +0 -6
  108. data/spec/fixtures/json_only.yml +0 -18
  109. data/spec/fixtures/locales.yml +0 -133
  110. data/spec/fixtures/merge_plurals.yml +0 -6
  111. data/spec/fixtures/merge_plurals_with_no_overrides.yml +0 -4
  112. data/spec/fixtures/merge_plurals_with_partial_overrides.yml +0 -4
  113. data/spec/fixtures/millions.yml +0 -4
  114. data/spec/fixtures/multiple_conditions.yml +0 -7
  115. data/spec/fixtures/multiple_conditions_per_locale.yml +0 -7
  116. data/spec/fixtures/multiple_files.yml +0 -7
  117. data/spec/fixtures/no_config.yml +0 -2
  118. data/spec/fixtures/no_scope.yml +0 -4
  119. data/spec/fixtures/simple_scope.yml +0 -5
  120. data/spec/js/currency.spec.js +0 -62
  121. data/spec/js/current_locale.spec.js +0 -19
  122. data/spec/js/dates.spec.js +0 -276
  123. data/spec/js/defaults.spec.js +0 -31
  124. data/spec/js/extend.spec.js +0 -110
  125. data/spec/js/interpolation.spec.js +0 -124
  126. data/spec/js/jasmine/MIT.LICENSE +0 -20
  127. data/spec/js/jasmine/jasmine-html.js +0 -190
  128. data/spec/js/jasmine/jasmine.css +0 -166
  129. data/spec/js/jasmine/jasmine.js +0 -2476
  130. data/spec/js/jasmine/jasmine_favicon.png +0 -0
  131. data/spec/js/json_parsable.spec.js +0 -14
  132. data/spec/js/locales.spec.js +0 -31
  133. data/spec/js/localization.spec.js +0 -78
  134. data/spec/js/numbers.spec.js +0 -174
  135. data/spec/js/placeholder.spec.js +0 -24
  136. data/spec/js/pluralization.spec.js +0 -228
  137. data/spec/js/prepare_options.spec.js +0 -41
  138. data/spec/js/require.js +0 -2083
  139. data/spec/js/specs.html +0 -49
  140. data/spec/js/specs_requirejs.html +0 -72
  141. data/spec/js/translate.spec.js +0 -304
  142. data/spec/js/translations.js +0 -188
  143. data/spec/js/utility_functions.spec.js +0 -20
  144. data/spec/ruby/i18n/js/fallback_locales_spec.rb +0 -84
  145. data/spec/ruby/i18n/js/segment_spec.rb +0 -286
  146. data/spec/ruby/i18n/js/utils_spec.rb +0 -138
  147. data/spec/ruby/i18n/js_spec.rb +0 -797
  148. data/spec/spec_helper.rb +0 -80
  149. data/yarn.lock +0 -138
@@ -1,110 +0,0 @@
1
- var I18n = require("../../app/assets/javascripts/i18n")
2
- , Translations = require("./translations")
3
- ;
4
-
5
- describe("Extend", function () {
6
- it("should return an object", function () {
7
- expect(typeof I18n.extend()).toBe('object');
8
- });
9
-
10
- it("should merge 2 objects into 1", function () {
11
- var obj1 = {
12
- test1: "abc"
13
- }
14
- , obj2 = {
15
- test2: "xyz"
16
- }
17
- , expected = {
18
- test1: "abc"
19
- , test2: "xyz"
20
- };
21
-
22
- expect(I18n.extend(obj1,obj2)).toEqual(expected);
23
- });
24
- it("should overwrite a property from obj1 with the same property of obj2", function () {
25
- var obj1 = {
26
- test1: "abc"
27
- , test3: "def"
28
- }
29
- , obj2 = {
30
- test2: "xyz"
31
- , test3: "uvw"
32
- }
33
- , expected = {
34
- test1: "abc"
35
- , test2: "xyz"
36
- , test3: "uvw"
37
- };
38
-
39
- expect(I18n.extend(obj1,obj2)).toEqual(expected);
40
- });
41
-
42
- it("should merge deeply from obj1 with the same key of obj2", function() {
43
- var obj1 = {
44
- test1: {
45
- test2: "abc"
46
- }
47
- }
48
- , obj2 = {
49
- test1: {
50
- test3: "xyz"
51
- }
52
- }
53
- , expected = {
54
- test1: {
55
- test2: "abc"
56
- , test3: "xyz"
57
- }
58
- }
59
-
60
- expect(I18n.extend(obj1, obj2)).toEqual(expected);
61
- });
62
-
63
- it("should correctly merge string, numberic, boolean, and null values", function() {
64
- var obj1 = {
65
- test1: {
66
- test2: false
67
- }
68
- }
69
- , obj2 = {
70
- test1: {
71
- test3: 23,
72
- test4: 'abc',
73
- test5: null
74
- }
75
- }
76
- , expected = {
77
- test1: {
78
- test2: false
79
- , test3: 23
80
- , test4: 'abc'
81
- , test5: null
82
- }
83
- }
84
-
85
- expect(I18n.extend(obj1, obj2)).toEqual(expected);
86
- });
87
-
88
- it("should merge array values", function() {
89
- var obj1 = {
90
- array1: [1, 2]
91
- },
92
- obj2 = {
93
- array2: [1, 2],
94
- obj3: {
95
- array3: [1, 2],
96
- array4: [{obj4: 1}, 2]
97
- }
98
- },
99
- expected = {
100
- array1: [1, 2],
101
- array2: [1, 2],
102
- obj3: {
103
- array3: [1, 2],
104
- array4: [{obj4: 1}, 2]
105
- }
106
- }
107
-
108
- expect(JSON.stringify(I18n.extend(obj1, obj2))).toEqual(JSON.stringify(expected));
109
- });
110
- });
@@ -1,124 +0,0 @@
1
- var I18n = require("../../app/assets/javascripts/i18n")
2
- , Translations = require("./translations")
3
- ;
4
-
5
- describe("Interpolation", function(){
6
- var actual, expected;
7
-
8
- beforeEach(function(){
9
- I18n.reset();
10
- I18n.translations = Translations();
11
- });
12
-
13
- it("performs single interpolation", function(){
14
- actual = I18n.t("greetings.name", {name: "John Doe"});
15
- expect(actual).toEqual("Hello John Doe!");
16
- });
17
-
18
- it("performs multiple interpolations", function(){
19
- actual = I18n.t("profile.details", {name: "John Doe", age: 27});
20
- expect(actual).toEqual("John Doe is 27-years old");
21
- });
22
-
23
- describe("Pluralization", function() {
24
- var translation_key;
25
-
26
- describe("when count is passed in", function() {
27
- describe("and translation key does contain pluralization", function() {
28
- beforeEach(function() {
29
- translation_key = "inbox";
30
- });
31
-
32
- it("return translated and pluralized string", function() {
33
- expect(I18n.t(translation_key, {count: 0})).toEqual("You have no messages");
34
- expect(I18n.t(translation_key, {count: 1})).toEqual("You have 1 message");
35
- expect(I18n.t(translation_key, {count: 5})).toEqual("You have 5 messages");
36
- });
37
- });
38
- describe("and translation key does NOT contain pluralization", function() {
39
- beforeEach(function() {
40
- translation_key = "hello";
41
- });
42
-
43
- it("return translated string ONLY", function() {
44
- expect(I18n.t(translation_key, {count: 0})).toEqual("Hello World!");
45
- expect(I18n.t(translation_key, {count: 1})).toEqual("Hello World!");
46
- expect(I18n.t(translation_key, {count: 5})).toEqual("Hello World!");
47
- });
48
- });
49
- describe("and translation key does contain pluralization with null content", function() {
50
- beforeEach(function() {
51
- translation_key = "sent";
52
- });
53
-
54
- it("return empty string", function() {
55
- expect(I18n.t(translation_key, {count: 0})).toEqual('[missing "en.sent.zero" translation]');
56
- expect(I18n.t(translation_key, {count: 1})).toEqual('[missing "en.sent.one" translation]');
57
- expect(I18n.t(translation_key, {count: 5})).toEqual('[missing "en.sent.other" translation]');
58
- });
59
- });
60
- });
61
-
62
- describe("when count is NOT passed in", function() {
63
- describe("and translation key does contain pluralization", function() {
64
- beforeEach(function() {
65
- translation_key = "inbox";
66
- });
67
-
68
- var expected_translation_object = {
69
- one : 'You have {{count}} message',
70
- other : 'You have {{count}} messages',
71
- zero : 'You have no messages'
72
- }
73
-
74
- it("return translated and pluralized string", function() {
75
- expect(I18n.t(translation_key, {not_count: 0})).toEqual(expected_translation_object);
76
- expect(I18n.t(translation_key, {not_count: 1})).toEqual(expected_translation_object);
77
- expect(I18n.t(translation_key, {not_count: 5})).toEqual(expected_translation_object);
78
- });
79
- });
80
- describe("and translation key does NOT contain pluralization", function() {
81
- beforeEach(function() {
82
- translation_key = "hello";
83
- });
84
-
85
- it("return translated string ONLY", function() {
86
- expect(I18n.t(translation_key, {not_count: 0})).toEqual("Hello World!");
87
- expect(I18n.t(translation_key, {not_count: 1})).toEqual("Hello World!");
88
- expect(I18n.t(translation_key, {not_count: 5})).toEqual("Hello World!");
89
- });
90
- });
91
- });
92
- });
93
-
94
- it("outputs missing placeholder message if interpolation value is missing", function(){
95
- actual = I18n.t("greetings.name");
96
- expect(actual).toEqual("Hello [missing {{name}} value]!");
97
- });
98
-
99
- it("outputs missing placeholder message if interpolation value is null", function(){
100
- actual = I18n.t("greetings.name", {name: null});
101
- expect(actual).toEqual("Hello [missing {{name}} value]!");
102
- });
103
-
104
- it("allows overriding the null placeholder message", function(){
105
- var orig = I18n.nullPlaceholder;
106
- I18n.nullPlaceholder = function() {return "";}
107
- actual = I18n.t("greetings.name", {name: null});
108
- expect(actual).toEqual("Hello !");
109
- I18n.nullPlaceholder = orig;
110
- });
111
-
112
- it("provides missingPlaceholder with the placeholder, message, and options object", function(){
113
- var orig = I18n.missingPlaceholder;
114
- I18n.missingPlaceholder = function(placeholder, message, options) {
115
- expect(placeholder).toEqual('{{name}}');
116
- expect(message).toEqual('Hello {{name}}!');
117
- expect(options.debugScope).toEqual('landing-page');
118
- return '[missing-placeholder-debug]';
119
- };
120
- actual = I18n.t("greetings.name", {debugScope: 'landing-page'});
121
- expect(actual).toEqual("Hello [missing-placeholder-debug]!");
122
- I18n.missingPlaceholder = orig;
123
- });
124
- });
@@ -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
- };
@@ -1,166 +0,0 @@
1
- body {
2
- font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
3
- }
4
-
5
-
6
- .jasmine_reporter a:visited, .jasmine_reporter a {
7
- color: #303;
8
- }
9
-
10
- .jasmine_reporter a:hover, .jasmine_reporter a:active {
11
- color: blue;
12
- }
13
-
14
- .run_spec {
15
- float:right;
16
- padding-right: 5px;
17
- font-size: .8em;
18
- text-decoration: none;
19
- }
20
-
21
- .jasmine_reporter {
22
- margin: 0 5px;
23
- }
24
-
25
- .banner {
26
- color: #303;
27
- background-color: #fef;
28
- padding: 5px;
29
- }
30
-
31
- .logo {
32
- float: left;
33
- font-size: 1.1em;
34
- padding-left: 5px;
35
- }
36
-
37
- .logo .version {
38
- font-size: .6em;
39
- padding-left: 1em;
40
- }
41
-
42
- .runner.running {
43
- background-color: yellow;
44
- }
45
-
46
-
47
- .options {
48
- text-align: right;
49
- font-size: .8em;
50
- }
51
-
52
-
53
-
54
-
55
- .suite {
56
- border: 1px outset gray;
57
- margin: 5px 0;
58
- padding-left: 1em;
59
- }
60
-
61
- .suite .suite {
62
- margin: 5px;
63
- }
64
-
65
- .suite.passed {
66
- background-color: #dfd;
67
- }
68
-
69
- .suite.failed {
70
- background-color: #fdd;
71
- }
72
-
73
- .spec {
74
- margin: 5px;
75
- padding-left: 1em;
76
- clear: both;
77
- }
78
-
79
- .spec.failed, .spec.passed, .spec.skipped {
80
- padding-bottom: 5px;
81
- border: 1px solid gray;
82
- }
83
-
84
- .spec.failed {
85
- background-color: #fbb;
86
- border-color: red;
87
- }
88
-
89
- .spec.passed {
90
- background-color: #bfb;
91
- border-color: green;
92
- }
93
-
94
- .spec.skipped {
95
- background-color: #bbb;
96
- }
97
-
98
- .messages {
99
- border-left: 1px dashed gray;
100
- padding-left: 1em;
101
- padding-right: 1em;
102
- }
103
-
104
- .passed {
105
- background-color: #cfc;
106
- display: none;
107
- }
108
-
109
- .failed {
110
- background-color: #fbb;
111
- }
112
-
113
- .skipped {
114
- color: #777;
115
- background-color: #eee;
116
- display: none;
117
- }
118
-
119
-
120
- /*.resultMessage {*/
121
- /*white-space: pre;*/
122
- /*}*/
123
-
124
- .resultMessage span.result {
125
- display: block;
126
- line-height: 2em;
127
- color: black;
128
- }
129
-
130
- .resultMessage .mismatch {
131
- color: black;
132
- }
133
-
134
- .stackTrace {
135
- white-space: pre;
136
- font-size: .8em;
137
- margin-left: 10px;
138
- max-height: 5em;
139
- overflow: auto;
140
- border: 1px inset red;
141
- padding: 1em;
142
- background: #eef;
143
- }
144
-
145
- .finished-at {
146
- padding-left: 1em;
147
- font-size: .6em;
148
- }
149
-
150
- .show-passed .passed,
151
- .show-skipped .skipped {
152
- display: block;
153
- }
154
-
155
-
156
- #jasmine_content {
157
- position:fixed;
158
- right: 100%;
159
- }
160
-
161
- .runner {
162
- border: 1px solid gray;
163
- display: block;
164
- margin: 5px 0;
165
- padding: 2px 0 2px 10px;
166
- }