i18n-js 2.1.2 → 3.0.0.rc1

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.
Files changed (55) hide show
  1. data/Gemfile.lock +23 -31
  2. data/README.md +318 -0
  3. data/Rakefile +6 -6
  4. data/app/assets/javascripts/i18n/translations.js.erb +3 -0
  5. data/i18n-js.gemspec +5 -6
  6. data/lib/i18n-js.rb +1 -177
  7. data/lib/i18n.js +698 -0
  8. data/lib/i18n/js.rb +157 -0
  9. data/lib/i18n/js/engine.rb +22 -0
  10. data/lib/{i18n-js → i18n/js}/middleware.rb +7 -7
  11. data/lib/i18n/js/version.rb +10 -0
  12. data/spec/{resources → fixtures}/custom_path.yml +1 -1
  13. data/spec/{resources → fixtures}/default.yml +1 -1
  14. data/spec/fixtures/js_file_per_locale.yml +3 -0
  15. data/spec/{resources → fixtures}/locales.yml +1 -1
  16. data/spec/fixtures/multiple_conditions.yml +5 -0
  17. data/spec/{resources → fixtures}/multiple_files.yml +3 -3
  18. data/spec/{resources → fixtures}/no_config.yml +0 -0
  19. data/spec/{resources → fixtures}/no_scope.yml +1 -1
  20. data/spec/{resources → fixtures}/simple_scope.yml +1 -1
  21. data/spec/i18n_js_spec.rb +122 -0
  22. data/spec/js/currency.spec.js +60 -0
  23. data/spec/js/current_locale.spec.js +19 -0
  24. data/spec/js/dates.spec.js +218 -0
  25. data/spec/js/defaults.spec.js +23 -0
  26. data/spec/js/interpolation.spec.js +28 -0
  27. data/spec/js/jasmine/MIT.LICENSE +20 -0
  28. data/spec/js/jasmine/jasmine-html.js +190 -0
  29. data/spec/js/jasmine/jasmine.css +166 -0
  30. data/spec/js/jasmine/jasmine.js +2476 -0
  31. data/spec/js/jasmine/jasmine_favicon.png +0 -0
  32. data/spec/js/localization.spec.js +41 -0
  33. data/spec/js/numbers.spec.js +124 -0
  34. data/spec/js/placeholder.spec.js +24 -0
  35. data/spec/js/pluralization.spec.js +105 -0
  36. data/spec/js/prepare_options.spec.js +41 -0
  37. data/spec/js/specs.html +46 -0
  38. data/spec/js/translate.spec.js +115 -0
  39. data/spec/js/translations.js +115 -0
  40. data/spec/spec_helper.rb +36 -14
  41. metadata +115 -69
  42. data/.gitignore +0 -5
  43. data/.rspec +0 -1
  44. data/README.rdoc +0 -305
  45. data/config/i18n-js.yml +0 -22
  46. data/lib/i18n-js/engine.rb +0 -62
  47. data/lib/i18n-js/railtie.rb +0 -13
  48. data/lib/i18n-js/rake.rb +0 -16
  49. data/lib/i18n-js/version.rb +0 -10
  50. data/spec/i18n_spec.js +0 -768
  51. data/spec/i18n_spec.rb +0 -205
  52. data/spec/resources/js_file_per_locale.yml +0 -3
  53. data/spec/resources/multiple_conditions.yml +0 -6
  54. data/vendor/assets/javascripts/i18n.js +0 -450
  55. data/vendor/assets/javascripts/i18n/translations.js.erb +0 -7
@@ -0,0 +1,19 @@
1
+ var I18n = require("../../lib/i18n");
2
+
3
+ describe("Current locale", function(){
4
+ beforeEach(function(){
5
+ I18n.reset();
6
+ });
7
+
8
+ it("returns I18n.locale", function(){
9
+ I18n.locale = "pt-BR";
10
+ expect(I18n.currentLocale()).toEqual("pt-BR");
11
+ });
12
+
13
+ it("returns I18n.defaultLocale", function(){
14
+ I18n.locale = null;
15
+ I18n.defaultLocale = "pt-BR";
16
+
17
+ expect(I18n.currentLocale()).toEqual("pt-BR");
18
+ });
19
+ });
@@ -0,0 +1,218 @@
1
+ var I18n = require("../../lib/i18n")
2
+ , Translations = require("./translations")
3
+ ;
4
+
5
+ describe("Dates", function(){
6
+ var actual, expected;
7
+
8
+ beforeEach(function() {
9
+ I18n.reset();
10
+ I18n.translations = Translations();
11
+ });
12
+
13
+ it("parses date", function(){
14
+ expected = new Date(2009, 0, 24, 0, 0, 0);
15
+ actual = I18n.parseDate("2009-01-24");
16
+ expect(actual.toString()).toEqual(expected.toString());
17
+
18
+ expected = new Date(2009, 0, 24, 0, 15, 0);
19
+ actual = I18n.parseDate("2009-01-24 00:15:00");
20
+ expect(actual.toString()).toEqual(expected.toString());
21
+
22
+ expected = new Date(2009, 0, 24, 0, 0, 15);
23
+ actual = I18n.parseDate("2009-01-24 00:00:15");
24
+ expect(actual.toString()).toEqual(expected.toString());
25
+
26
+ expected = new Date(2009, 0, 24, 15, 33, 44);
27
+ actual = I18n.parseDate("2009-01-24 15:33:44");
28
+ expect(actual.toString()).toEqual(expected.toString());
29
+
30
+ expected = new Date(2009, 0, 24, 0, 0, 0);
31
+ actual = I18n.parseDate(expected.getTime());
32
+ expect(actual.toString()).toEqual(expected.toString());
33
+
34
+ expected = new Date(2009, 0, 24, 0, 0, 0);
35
+ actual = I18n.parseDate("01/24/2009");
36
+ expect(actual.toString()).toEqual(expected.toString());
37
+
38
+ expected = new Date(2009, 0, 24, 14, 33, 55);
39
+ actual = I18n.parseDate(expected).toString();
40
+ expect(actual).toEqual(expected.toString());
41
+
42
+ expected = new Date(2009, 0, 24, 15, 33, 44);
43
+ actual = I18n.parseDate("2009-01-24T15:33:44");
44
+ expect(actual.toString()).toEqual(expected.toString());
45
+
46
+ expected = new Date(Date.UTC(2011, 6, 20, 12, 51, 55));
47
+ actual = I18n.parseDate("2011-07-20T12:51:55+0000");
48
+ expect(actual.toString()).toEqual(expected.toString());
49
+
50
+ expected = new Date(Date.UTC(2011, 6, 20, 13, 03, 39));
51
+ actual = I18n.parseDate("Wed Jul 20 13:03:39 +0000 2011");
52
+ expect(actual.toString()).toEqual(expected.toString());
53
+
54
+ expected = new Date(Date.UTC(2009, 0, 24, 15, 33, 44));
55
+ actual = I18n.parseDate("2009-01-24T15:33:44Z");
56
+ expect(actual.toString()).toEqual(expected.toString());
57
+ });
58
+
59
+ it("formats date", function(){
60
+ I18n.locale = "pt-BR";
61
+
62
+ // 2009-04-26 19:35:44 (Sunday)
63
+ var date = new Date(2009, 3, 26, 19, 35, 44);
64
+
65
+ // short week day
66
+ expect(I18n.strftime(date, "%a")).toEqual("Dom");
67
+
68
+ // full week day
69
+ expect(I18n.strftime(date, "%A")).toEqual("Domingo");
70
+
71
+ // short month
72
+ expect(I18n.strftime(date, "%b")).toEqual("Abr");
73
+
74
+ // full month
75
+ expect(I18n.strftime(date, "%B")).toEqual("Abril");
76
+
77
+ // day
78
+ expect(I18n.strftime(date, "%d")).toEqual("26");
79
+
80
+ // 24-hour
81
+ expect(I18n.strftime(date, "%H")).toEqual("19");
82
+
83
+ // 12-hour
84
+ expect(I18n.strftime(date, "%I")).toEqual("07");
85
+
86
+ // month
87
+ expect(I18n.strftime(date, "%m")).toEqual("04");
88
+
89
+ // minutes
90
+ expect(I18n.strftime(date, "%M")).toEqual("35");
91
+
92
+ // meridian
93
+ expect(I18n.strftime(date, "%p")).toEqual("PM");
94
+
95
+ // seconds
96
+ expect(I18n.strftime(date, "%S")).toEqual("44");
97
+
98
+ // week day
99
+ expect(I18n.strftime(date, "%w")).toEqual("0");
100
+
101
+ // short year
102
+ expect(I18n.strftime(date, "%y")).toEqual("09");
103
+
104
+ // full year
105
+ expect(I18n.strftime(date, "%Y")).toEqual("2009");
106
+ });
107
+
108
+ it("formats date without padding", function(){
109
+ I18n.locale = "pt-BR";
110
+
111
+ // 2009-04-26 19:35:44 (Sunday)
112
+ var date = new Date(2009, 3, 9, 7, 8, 9);
113
+
114
+ // 24-hour without padding
115
+ expect(I18n.strftime(date, "%-H")).toEqual("7");
116
+
117
+ // 12-hour without padding
118
+ expect(I18n.strftime(date, "%-I")).toEqual("7");
119
+
120
+ // minutes without padding
121
+ expect(I18n.strftime(date, "%-M")).toEqual("8");
122
+
123
+ // seconds without padding
124
+ expect(I18n.strftime(date, "%-S")).toEqual("9");
125
+
126
+ // short year without padding
127
+ expect(I18n.strftime(date, "%-y")).toEqual("9");
128
+
129
+ // month without padding
130
+ expect(I18n.strftime(date, "%-m")).toEqual("4");
131
+
132
+ // day without padding
133
+ expect(I18n.strftime(date, "%-d")).toEqual("9");
134
+ expect(I18n.strftime(date, "%e")).toEqual("9");
135
+ });
136
+
137
+ it("formats date with padding", function(){
138
+ I18n.locale = "pt-BR";
139
+
140
+ // 2009-04-26 19:35:44 (Sunday)
141
+ var date = new Date(2009, 3, 9, 7, 8, 9);
142
+
143
+ // 24-hour
144
+ expect(I18n.strftime(date, "%H")).toEqual("07");
145
+
146
+ // 12-hour
147
+ expect(I18n.strftime(date, "%I")).toEqual("07");
148
+
149
+ // minutes
150
+ expect(I18n.strftime(date, "%M")).toEqual("08");
151
+
152
+ // seconds
153
+ expect(I18n.strftime(date, "%S")).toEqual("09");
154
+
155
+ // short year
156
+ expect(I18n.strftime(date, "%y")).toEqual("09");
157
+
158
+ // month
159
+ expect(I18n.strftime(date, "%m")).toEqual("04");
160
+
161
+ // day
162
+ expect(I18n.strftime(date, "%d")).toEqual("09");
163
+ });
164
+
165
+ it("formats date with negative time zone", function(){
166
+ I18n.locale = "pt-BR";
167
+ var date = new Date(2009, 3, 26, 19, 35, 44);
168
+
169
+ spyOn(date, "getTimezoneOffset").andReturn(345);
170
+
171
+ expect(I18n.strftime(date, "%z")).toMatch(/^(\+|-)[\d]{4}$/);
172
+ expect(I18n.strftime(date, "%z")).toEqual("-0545");
173
+ });
174
+
175
+ it("formats date with positive time zone", function(){
176
+ I18n.locale = "pt-BR";
177
+ var date = new Date(2009, 3, 26, 19, 35, 44);
178
+
179
+ spyOn(date, "getTimezoneOffset").andReturn(-345);
180
+
181
+ expect(I18n.strftime(date, "%z")).toMatch(/^(\+|-)[\d]{4}$/);
182
+ expect(I18n.strftime(date, "%z")).toEqual("+0545");
183
+ });
184
+
185
+ it("formats date with custom meridian", function(){
186
+ I18n.locale = "en-US";
187
+ var date = new Date(2009, 3, 26, 19, 35, 44);
188
+ expect(I18n.strftime(date, "%p")).toEqual("pm");
189
+ });
190
+
191
+ it("formats date with meridian boundaries", function(){
192
+ I18n.locale = "en-US";
193
+ var date = new Date(2009, 3, 26, 0, 35, 44);
194
+ expect(I18n.strftime(date, "%p")).toEqual("am");
195
+
196
+ date = new Date(2009, 3, 26, 12, 35, 44);
197
+ expect(I18n.strftime(date, "%p")).toEqual("pm");
198
+ });
199
+
200
+ it("formats date using 12-hours format", function(){
201
+ I18n.locale = "pt-BR";
202
+ var date = new Date(2009, 3, 26, 19, 35, 44);
203
+ expect(I18n.strftime(date, "%I")).toEqual("07");
204
+
205
+ date = new Date(2009, 3, 26, 12, 35, 44);
206
+ expect(I18n.strftime(date, "%I")).toEqual("12");
207
+
208
+ date = new Date(2009, 3, 26, 0, 35, 44);
209
+ expect(I18n.strftime(date, "%I")).toEqual("12");
210
+ });
211
+
212
+ it("defaults to English", function() {
213
+ I18n.locale = "wk";
214
+
215
+ var date = new Date(2009, 3, 26, 19, 35, 44);
216
+ expect(I18n.strftime(date, "%a")).toEqual("Sun");
217
+ });
218
+ });
@@ -0,0 +1,23 @@
1
+ var I18n = require("../../lib/i18n");
2
+
3
+ describe("Defaults", function(){
4
+ beforeEach(function(){
5
+ I18n.reset();
6
+ });
7
+
8
+ it("sets the default locale", function(){
9
+ expect(I18n.defaultLocale).toEqual("en");
10
+ });
11
+
12
+ it("sets current locale", function(){
13
+ expect(I18n.locale).toEqual("en");
14
+ });
15
+
16
+ it("sets default separator", function(){
17
+ expect(I18n.defaultSeparator).toEqual(".");
18
+ });
19
+
20
+ it("sets fallback", function(){
21
+ expect(I18n.fallbacks).toEqual(false);
22
+ });
23
+ });
@@ -0,0 +1,28 @@
1
+ var I18n = require("../../lib/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
+ it("performs interpolation with the count option", function(){
24
+ expect(I18n.t("inbox", {count: 0})).toEqual("You have no messages");
25
+ expect(I18n.t("inbox", {count: 1})).toEqual("You have 1 message");
26
+ expect(I18n.t("inbox", {count: 5})).toEqual("You have 5 messages");
27
+ });
28
+ });
@@ -0,0 +1,20 @@
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.
@@ -0,0 +1,190 @@
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
+ };