kea-rails 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kea-rails/version.rb +1 -1
  3. data/vendor/assets/components/Keypress/LICENSE +191 -0
  4. data/vendor/assets/components/Keypress/README.md +78 -0
  5. data/vendor/assets/components/Keypress/bower.json +28 -0
  6. data/vendor/assets/components/Keypress/keypress-2.1.0.min.js +33 -0
  7. data/vendor/assets/components/Keypress/keypress.coffee +921 -0
  8. data/vendor/assets/components/Keypress/keypress.js +1132 -0
  9. data/vendor/assets/components/Keypress/package.json +15 -0
  10. data/vendor/assets/components/attachejs/attache-jquery.js +47 -0
  11. data/vendor/assets/components/attachejs/attache-knockout.js +56 -0
  12. data/vendor/assets/components/attachejs/attache.css +10 -0
  13. data/vendor/assets/components/attachejs/attache.js +589 -0
  14. data/vendor/assets/components/attachejs/bower.json +36 -0
  15. data/vendor/assets/components/humane-js/bower.json +8 -0
  16. data/vendor/assets/components/humane-js/changelog.md +165 -0
  17. data/vendor/assets/components/humane-js/humane.js +238 -0
  18. data/vendor/assets/components/humane-js/humane.min.js +11 -0
  19. data/vendor/assets/components/humane-js/index.html +190 -0
  20. data/vendor/assets/components/humane-js/package.json +25 -0
  21. data/vendor/assets/components/humane-js/readme.md +85 -0
  22. data/vendor/assets/components/humane-js/test/issue23.html +11 -0
  23. data/vendor/assets/components/humane-js/test/issue36.html +9 -0
  24. data/vendor/assets/components/humane-js/test/issue38.html +15 -0
  25. data/vendor/assets/components/humane-js/test/issue49.html +9 -0
  26. data/vendor/assets/components/humane-js/theme-src/bigbox.styl +65 -0
  27. data/vendor/assets/components/humane-js/theme-src/boldlight.styl +64 -0
  28. data/vendor/assets/components/humane-js/theme-src/jackedup.styl +69 -0
  29. data/vendor/assets/components/humane-js/theme-src/libnotify.styl +61 -0
  30. data/vendor/assets/components/humane-js/theme-src/original.styl +51 -0
  31. data/vendor/assets/components/humane-js/themes/bigbox.css +123 -0
  32. data/vendor/assets/components/humane-js/themes/boldlight.css +122 -0
  33. data/vendor/assets/components/humane-js/themes/flatty.css +94 -0
  34. data/vendor/assets/components/humane-js/themes/jackedup.css +123 -0
  35. data/vendor/assets/components/humane-js/themes/libnotify.css +115 -0
  36. data/vendor/assets/components/humane-js/themes/original.css +72 -0
  37. data/vendor/assets/components/knockout-sortable/README.md +129 -0
  38. data/vendor/assets/components/knockout-sortable/bower.json +15 -0
  39. data/vendor/assets/components/knockout-sortable/build/knockout-sortable.js +358 -0
  40. data/vendor/assets/components/knockout-sortable/build/knockout-sortable.min.js +2 -0
  41. data/vendor/assets/components/uri.js/README.md +437 -0
  42. data/vendor/assets/components/uri.js/URI.jquery.json +38 -0
  43. data/vendor/assets/components/uri.js/about-uris.html +156 -0
  44. data/vendor/assets/components/uri.js/build.html +66 -0
  45. data/vendor/assets/components/uri.js/build.js +78 -0
  46. data/vendor/assets/components/uri.js/component.json +15 -0
  47. data/vendor/assets/components/uri.js/contribute.md +11 -0
  48. data/vendor/assets/components/uri.js/docs.html +1280 -0
  49. data/vendor/assets/components/uri.js/index.html +173 -0
  50. data/vendor/assets/components/uri.js/jquery-1.10.2.min.js +6 -0
  51. data/vendor/assets/components/uri.js/jquery-1.7.2.min.js +4 -0
  52. data/vendor/assets/components/uri.js/jquery-1.8.2.min.js +2 -0
  53. data/vendor/assets/components/uri.js/jquery-1.9.1.min.js +5 -0
  54. data/vendor/assets/components/uri.js/jquery-uri-plugin.html +203 -0
  55. data/vendor/assets/components/uri.js/package.json +75 -0
  56. data/vendor/assets/components/uri.js/prettify/lang-apollo.js +2 -0
  57. data/vendor/assets/components/uri.js/prettify/lang-clj.js +18 -0
  58. data/vendor/assets/components/uri.js/prettify/lang-css.js +2 -0
  59. data/vendor/assets/components/uri.js/prettify/lang-go.js +1 -0
  60. data/vendor/assets/components/uri.js/prettify/lang-hs.js +2 -0
  61. data/vendor/assets/components/uri.js/prettify/lang-lisp.js +3 -0
  62. data/vendor/assets/components/uri.js/prettify/lang-lua.js +2 -0
  63. data/vendor/assets/components/uri.js/prettify/lang-ml.js +2 -0
  64. data/vendor/assets/components/uri.js/prettify/lang-n.js +4 -0
  65. data/vendor/assets/components/uri.js/prettify/lang-proto.js +1 -0
  66. data/vendor/assets/components/uri.js/prettify/lang-scala.js +2 -0
  67. data/vendor/assets/components/uri.js/prettify/lang-sql.js +2 -0
  68. data/vendor/assets/components/uri.js/prettify/lang-tex.js +1 -0
  69. data/vendor/assets/components/uri.js/prettify/lang-vb.js +2 -0
  70. data/vendor/assets/components/uri.js/prettify/lang-vhdl.js +3 -0
  71. data/vendor/assets/components/uri.js/prettify/lang-wiki.js +2 -0
  72. data/vendor/assets/components/uri.js/prettify/lang-xq.js +3 -0
  73. data/vendor/assets/components/uri.js/prettify/lang-yaml.js +2 -0
  74. data/vendor/assets/components/uri.js/prettify/prettify.css +1 -0
  75. data/vendor/assets/components/uri.js/prettify/prettify.js +28 -0
  76. data/vendor/assets/components/uri.js/prettify/prettify.sunburst.css +52 -0
  77. data/vendor/assets/components/uri.js/screen.css +167 -0
  78. data/vendor/assets/components/uri.js/screen.js +39 -0
  79. data/vendor/assets/components/uri.js/src/IPv6.js +185 -0
  80. data/vendor/assets/components/uri.js/src/SecondLevelDomains.js +220 -0
  81. data/vendor/assets/components/uri.js/src/URI.fragmentQuery.js +103 -0
  82. data/vendor/assets/components/uri.js/src/URI.fragmentURI.js +96 -0
  83. data/vendor/assets/components/uri.js/src/URI.js +1938 -0
  84. data/vendor/assets/components/uri.js/src/URI.min.js +81 -0
  85. data/vendor/assets/components/uri.js/src/URITemplate.js +494 -0
  86. data/vendor/assets/components/uri.js/src/jquery.URI.js +232 -0
  87. data/vendor/assets/components/uri.js/src/jquery.URI.min.js +7 -0
  88. data/vendor/assets/components/uri.js/src/punycode.js +508 -0
  89. data/vendor/assets/components/uri.js/test/index.html +26 -0
  90. data/vendor/assets/components/uri.js/test/pre_libs.js +4 -0
  91. data/vendor/assets/components/uri.js/test/qunit/qunit-composite.css +13 -0
  92. data/vendor/assets/components/uri.js/test/qunit/qunit-composite.js +167 -0
  93. data/vendor/assets/components/uri.js/test/qunit/qunit.css +244 -0
  94. data/vendor/assets/components/uri.js/test/qunit/qunit.js +2212 -0
  95. data/vendor/assets/components/uri.js/test/test.URI.html +26 -0
  96. data/vendor/assets/components/uri.js/test/test.fragmentQuery.html +31 -0
  97. data/vendor/assets/components/uri.js/test/test.fragmentURI.html +31 -0
  98. data/vendor/assets/components/uri.js/test/test.jQuery-1.10.html +31 -0
  99. data/vendor/assets/components/uri.js/test/test.jQuery-1.7.html +31 -0
  100. data/vendor/assets/components/uri.js/test/test.jQuery-1.8.html +31 -0
  101. data/vendor/assets/components/uri.js/test/test.jQuery-1.9.html +31 -0
  102. data/vendor/assets/components/uri.js/test/test.js +1409 -0
  103. data/vendor/assets/components/uri.js/test/test_fragmentQuery.js +57 -0
  104. data/vendor/assets/components/uri.js/test/test_fragmentURI.js +59 -0
  105. data/vendor/assets/components/uri.js/test/test_jim.js +143 -0
  106. data/vendor/assets/components/uri.js/test/test_jquery.js +138 -0
  107. data/vendor/assets/components/uri.js/test/test_template.js +385 -0
  108. data/vendor/assets/components/uri.js/test/urls.js +1236 -0
  109. data/vendor/assets/components/uri.js/uri-template.html +234 -0
  110. data/vendor/assets/components/uri.js/utils/SLDs.php +37 -0
  111. data/vendor/assets/components/uri.js/utils/sld.js +101 -0
  112. data/vendor/assets/components/veiljs/bower.json +36 -0
  113. data/vendor/assets/components/veiljs/veil-jquery.js +47 -0
  114. data/vendor/assets/components/veiljs/veil-knockout.js +55 -0
  115. data/vendor/assets/components/veiljs/veil.js +465 -0
  116. data/vendor/assets/javascripts/fuse.js +472 -0
  117. data/vendor/assets/javascripts/jquery-ui.js +3844 -0
  118. data/vendor/assets/javascripts/knockout-3.2.0-debug.js +5299 -0
  119. data/vendor/assets/javascripts/moment.js +1902 -0
  120. data/vendor/assets/javascripts/pikaday.js +896 -0
  121. data/vendor/assets/stylesheets/pikaday.css +171 -0
  122. metadata +120 -1
@@ -0,0 +1,385 @@
1
+ (function(){
2
+ var levels = {
3
+ // http://tools.ietf.org/html/rfc6570#section-1.2
4
+ "Level 1" : {
5
+ expressions : {
6
+ 'Simple string expansion' : {
7
+ "{var}" : "value",
8
+ "{hello}" : "Hello%20World%21"
9
+ }
10
+ },
11
+ values : {
12
+ "var" : "value",
13
+ "hello" : "Hello World!"
14
+ }
15
+ },
16
+ "Level 2" : {
17
+ expressions : {
18
+ 'Reserved string expansion' : {
19
+ "{+var}" : "value",
20
+ "{+hello}" : "Hello%20World!",
21
+ "{+path}/here" : "/foo/bar/here",
22
+ "here?ref={+path}" : "here?ref=/foo/bar"
23
+ },
24
+ 'Fragment expansion, crosshatch-prefixed' : {
25
+ "X{#var}" : "X#value",
26
+ "X{#hello}" : "X#Hello%20World!"
27
+ }
28
+ },
29
+ values : {
30
+ "var" : "value",
31
+ "hello" : "Hello World!",
32
+ "path" : "/foo/bar"
33
+ }
34
+ },
35
+ "Level 3" : {
36
+ expressions : {
37
+ "String expansion with multiple variables" : {
38
+ "map?{x,y}" : "map?1024,768",
39
+ "{x,hello,y}" : "1024,Hello%20World%21,768"
40
+ },
41
+ "Reserved expansion with multiple variables" : {
42
+ "{+x,hello,y}" : "1024,Hello%20World!,768",
43
+ "{+path,x}/here" : "/foo/bar,1024/here"
44
+ },
45
+ "Fragment expansion with multiple variables" : {
46
+ "{#x,hello,y}" : "#1024,Hello%20World!,768",
47
+ "{#path,x}/here" : "#/foo/bar,1024/here"
48
+ },
49
+ "Label expansion, dot-prefixed" : {
50
+ "X{.var}" : "X.value",
51
+ "X{.x,y}" : "X.1024.768"
52
+ },
53
+ "Path segments, slash-prefixed" : {
54
+ "{/var}" : "/value",
55
+ "{/var,x}/here" : "/value/1024/here"
56
+ },
57
+ "Path-style parameters, semicolon-prefixed" : {
58
+ "{;x,y}" : ";x=1024;y=768",
59
+ "{;x,y,empty}" : ";x=1024;y=768;empty"
60
+ },
61
+ "Form-style query, ampersand-separated" : {
62
+ "{?x,y}" : "?x=1024&y=768",
63
+ "{?x,y,empty}" : "?x=1024&y=768&empty="
64
+ },
65
+ "Form-style query continuation" : {
66
+ "?fixed=yes{&x}" : "?fixed=yes&x=1024",
67
+ "{&x,y,empty}" : "&x=1024&y=768&empty="
68
+ }
69
+ },
70
+ values : {
71
+ "var" : "value",
72
+ "hello" : "Hello World!",
73
+ "empty" : "",
74
+ "path" : "/foo/bar",
75
+ "x" : "1024",
76
+ "y" : "768"
77
+ }
78
+ },
79
+ "Level 4" : {
80
+ expressions : {
81
+ "String expansion with value modifiers" : {
82
+ "{var:3}" : "val",
83
+ "{var:30}" : "value",
84
+ "{list}" : "red,green,blue",
85
+ "{list*}" : "red,green,blue",
86
+ "{keys}" : "semi,%3B,dot,.,comma,%2C",
87
+ "{keys*}" : "semi=%3B,dot=.,comma=%2C"
88
+ },
89
+ "Reserved expansion with value modifiers" : {
90
+ "{+path:6}/here" : "/foo/b/here",
91
+ "{+list}" : "red,green,blue",
92
+ "{+list*}" : "red,green,blue",
93
+ "{+keys}" : "semi,;,dot,.,comma,,",
94
+ "{+keys*}" : "semi=;,dot=.,comma=,"
95
+ },
96
+ "Fragment expansion with value modifiers" : {
97
+ "{#path:6}/here" : "#/foo/b/here",
98
+ "{#list}" : "#red,green,blue",
99
+ "{#list*}" : "#red,green,blue",
100
+ "{#keys}" : "#semi,;,dot,.,comma,,",
101
+ "{#keys*}" : "#semi=;,dot=.,comma=,"
102
+ },
103
+ "Label expansion, dot-prefixed" : {
104
+ "X{.var:3}" : "X.val",
105
+ "X{.list}" : "X.red,green,blue",
106
+ "X{.list*}" : "X.red.green.blue",
107
+ "X{.keys}" : "X.semi,%3B,dot,.,comma,%2C",
108
+ "X{.keys*}" : "X.semi=%3B.dot=..comma=%2C"
109
+ },
110
+ "Path segments, slash-prefixed" : {
111
+ "{/var:1,var}" : "/v/value",
112
+ "{/list}" : "/red,green,blue",
113
+ "{/list*}" : "/red/green/blue",
114
+ "{/list*,path:4}" : "/red/green/blue/%2Ffoo",
115
+ "{/keys}" : "/semi,%3B,dot,.,comma,%2C",
116
+ "{/keys*}" : "/semi=%3B/dot=./comma=%2C"
117
+ },
118
+ "Path-style parameters, semicolon-prefixed" : {
119
+ "{;hello:5}" : ";hello=Hello",
120
+ "{;list}" : ";list=red,green,blue",
121
+ "{;list*}" : ";list=red;list=green;list=blue",
122
+ "{;keys}" : ";keys=semi,%3B,dot,.,comma,%2C",
123
+ "{;keys*}" : ";semi=%3B;dot=.;comma=%2C"
124
+ },
125
+
126
+ "Form-style query, ampersand-separated" : {
127
+ "{?var:3}" : "?var=val",
128
+ "{?list}" : "?list=red,green,blue",
129
+ "{?list*}" : "?list=red&list=green&list=blue",
130
+ "{?keys}" : "?keys=semi,%3B,dot,.,comma,%2C",
131
+ "{?keys*}" : "?semi=%3B&dot=.&comma=%2C"
132
+ },
133
+ "Form-style query continuation" : {
134
+ "{&var:3}" : "&var=val",
135
+ "{&list}" : "&list=red,green,blue",
136
+ "{&list*}" : "&list=red&list=green&list=blue",
137
+ "{&keys}" : "&keys=semi,%3B,dot,.,comma,%2C",
138
+ "{&keys*}" : "&semi=%3B&dot=.&comma=%2C"
139
+ }
140
+ },
141
+ values : {
142
+ "var" : "value",
143
+ "hello" : "Hello World!",
144
+ "path" : "/foo/bar",
145
+ "list" : ["red", "green", "blue"],
146
+ "keys" : {
147
+ "semi" : ";",
148
+ "dot" : ".",
149
+ "comma" : ","
150
+ }
151
+ }
152
+ },
153
+ // http://tools.ietf.org/html/rfc6570#section-3
154
+ "Expression Expansion" : {
155
+ expressions : {
156
+ "Variable Expansion" : {
157
+ "{count}" : "one,two,three",
158
+ "{count*}" : "one,two,three",
159
+ "{/count}" : "/one,two,three",
160
+ "{/count*}" : "/one/two/three",
161
+ "{;count}" : ";count=one,two,three",
162
+ "{;count*}" : ";count=one;count=two;count=three",
163
+ "{?count}" : "?count=one,two,three",
164
+ "{?count*}" : "?count=one&count=two&count=three",
165
+ "{&count*}" : "&count=one&count=two&count=three"
166
+ },
167
+ "Simple String Expansion" : {
168
+ "{var}" : "value",
169
+ "{hello}" : "Hello%20World%21",
170
+ "{half}" : "50%25",
171
+ "O{empty}X" : "OX",
172
+ "O{undef}X" : "OX",
173
+ "{x,y}" : "1024,768",
174
+ "{x,hello,y}" : "1024,Hello%20World%21,768",
175
+ "?{x,empty}" : "?1024,",
176
+ "?{x,undef}" : "?1024",
177
+ "?{undef,y}" : "?768",
178
+ "{var:3}" : "val",
179
+ "{var:30}" : "value",
180
+ "{list}" : "red,green,blue",
181
+ "{list*}" : "red,green,blue",
182
+ "{keys}" : "semi,%3B,dot,.,comma,%2C",
183
+ "{keys*}" : "semi=%3B,dot=.,comma=%2C"
184
+ },
185
+ "Reserved Expansion" : {
186
+ "{+var}" : "value",
187
+ "{+hello}" : "Hello%20World!",
188
+ "{+half}" : "50%25",
189
+ "{base}index" : "http%3A%2F%2Fexample.com%2Fhome%2Findex",
190
+ "{+base}index" : "http://example.com/home/index",
191
+ "O{+empty}X" : "OX",
192
+ "O{+undef}X" : "OX",
193
+ "{+path}/here" : "/foo/bar/here",
194
+ "here?ref={+path}" : "here?ref=/foo/bar",
195
+ "up{+path}{var}/here" : "up/foo/barvalue/here",
196
+ "{+x,hello,y}" : "1024,Hello%20World!,768",
197
+ "{+path,x}/here" : "/foo/bar,1024/here",
198
+ "{+path:6}/here" : "/foo/b/here",
199
+ "{+list}" : "red,green,blue",
200
+ "{+list*}" : "red,green,blue",
201
+ "{+keys}" : "semi,;,dot,.,comma,,",
202
+ "{+keys*}" : "semi=;,dot=.,comma=,"
203
+ },
204
+ "Fragment Expansion" : {
205
+ "{#var}" : "#value",
206
+ "{#hello}" : "#Hello%20World!",
207
+ "{#half}" : "#50%25",
208
+ "foo{#empty}" : "foo#",
209
+ "foo{#undef}" : "foo",
210
+ "{#x,hello,y}" : "#1024,Hello%20World!,768",
211
+ "{#path,x}/here" : "#/foo/bar,1024/here",
212
+ "{#path:6}/here" : "#/foo/b/here",
213
+ "{#list}" : "#red,green,blue",
214
+ "{#list*}" : "#red,green,blue",
215
+ "{#keys}" : "#semi,;,dot,.,comma,,",
216
+ "{#keys*}" : "#semi=;,dot=.,comma=,"
217
+ },
218
+ "Label Expansion with Dot-Prefix" : {
219
+ "{.who}" : ".fred",
220
+ "{.who,who}" : ".fred.fred",
221
+ "{.half,who}" : ".50%25.fred",
222
+ "www{.dom*}" : "www.example.com",
223
+ "X{.var}" : "X.value",
224
+ "X{.empty}" : "X.",
225
+ "X{.undef}" : "X",
226
+ "X{.var:3}" : "X.val",
227
+ "X{.list}" : "X.red,green,blue",
228
+ "X{.list*}" : "X.red.green.blue",
229
+ "X{.keys}" : "X.semi,%3B,dot,.,comma,%2C",
230
+ "X{.keys*}" : "X.semi=%3B.dot=..comma=%2C",
231
+ "X{.empty_keys}" : "X",
232
+ "X{.empty_keys*}" : "X"
233
+ },
234
+ "Path Segment Expansion" : {
235
+ "{/who}" : "/fred",
236
+ "{/who,who}" : "/fred/fred",
237
+ "{/half,who}" : "/50%25/fred",
238
+ "{/who,dub}" : "/fred/me%2Ftoo",
239
+ "{/var}" : "/value",
240
+ "{/var,empty}" : "/value/",
241
+ "{/var,undef}" : "/value",
242
+ "{/var,x}/here" : "/value/1024/here",
243
+ "{/var:1,var}" : "/v/value",
244
+ "{/list}" : "/red,green,blue",
245
+ "{/list*}" : "/red/green/blue",
246
+ "{/list*,path:4}" : "/red/green/blue/%2Ffoo",
247
+ "{/keys}" : "/semi,%3B,dot,.,comma,%2C",
248
+ "{/keys*}" : "/semi=%3B/dot=./comma=%2C"
249
+ },
250
+ "Path-Style Parameter Expansion" : {
251
+ "{;who}" : ";who=fred",
252
+ "{;half}" : ";half=50%25",
253
+ "{;empty}" : ";empty",
254
+ "{;v,empty,who}" : ";v=6;empty;who=fred",
255
+ "{;v,bar,who}" : ";v=6;who=fred",
256
+ "{;x,y}" : ";x=1024;y=768",
257
+ "{;x,y,empty}" : ";x=1024;y=768;empty",
258
+ "{;x,y,undef}" : ";x=1024;y=768",
259
+ "{;hello:5}" : ";hello=Hello",
260
+ "{;list}" : ";list=red,green,blue",
261
+ "{;list*}" : ";list=red;list=green;list=blue",
262
+ "{;keys}" : ";keys=semi,%3B,dot,.,comma,%2C",
263
+ "{;keys*}" : ";semi=%3B;dot=.;comma=%2C"
264
+ },
265
+ "Form-Style Query Expansion" : {
266
+ "{?who}" : "?who=fred",
267
+ "{?half}" : "?half=50%25",
268
+ "{?x,y}" : "?x=1024&y=768",
269
+ "{?x,y,empty}" : "?x=1024&y=768&empty=",
270
+ "{?x,y,undef}" : "?x=1024&y=768",
271
+ "{?var:3}" : "?var=val",
272
+ "{?list}" : "?list=red,green,blue",
273
+ "{?list*}" : "?list=red&list=green&list=blue",
274
+ "{?keys}" : "?keys=semi,%3B,dot,.,comma,%2C",
275
+ "{?keys*}" : "?semi=%3B&dot=.&comma=%2C"
276
+ },
277
+ "Form-Style Query Continuation" : {
278
+ "{&who}" : "&who=fred",
279
+ "{&half}" : "&half=50%25",
280
+ "?fixed=yes{&x}" : "?fixed=yes&x=1024",
281
+ "{&x,y,empty}" : "&x=1024&y=768&empty=",
282
+ "{&x,y,undef}" : "&x=1024&y=768",
283
+ "{&var:3}" : "&var=val",
284
+ "{&list}" : "&list=red,green,blue",
285
+ "{&list*}" : "&list=red&list=green&list=blue",
286
+ "{&keys}" : "&keys=semi,%3B,dot,.,comma,%2C",
287
+ "{&keys*}" : "&semi=%3B&dot=.&comma=%2C"
288
+ }
289
+ },
290
+ values : {
291
+ "count" : ["one", "two", "three"],
292
+ "dom" : ["example", "com"],
293
+ "dub" : "me/too",
294
+ "hello" : "Hello World!",
295
+ "half" : "50%",
296
+ "var" : "value",
297
+ "who" : "fred",
298
+ "base" : "http://example.com/home/",
299
+ "path" : "/foo/bar",
300
+ "list" : ["red", "green", "blue"],
301
+ "keys" : {
302
+ "semi" : ";",
303
+ "dot" : ".",
304
+ "comma" : ","
305
+ },
306
+ "v" : "6",
307
+ "x" : "1024",
308
+ "y" : "768",
309
+ "empty" : "",
310
+ "empty_keys" : [],
311
+ "undef" : null
312
+ }
313
+ }
314
+ };
315
+
316
+ module("URITemplate");
317
+ // [].forEach() no IE, lacking interest in polyfilling this...
318
+ for (var i in levels) {
319
+ (function(level, data){
320
+ test(level, function() {
321
+ var combined_expression = "",
322
+ combined_expansion = "",
323
+ template, expression, expansion;
324
+
325
+ for (type in data.expressions) {
326
+ for (expression in data.expressions[type]) {
327
+ combined_expression += "/" + expression;
328
+ combined_expansion += "/" + data.expressions[type][expression];
329
+
330
+ template = new URITemplate(expression);
331
+ expansion = template.expand(data.values);
332
+ equal(expansion, data.expressions[type][expression], type + ": " + expression);
333
+ }
334
+ }
335
+
336
+ template = new URITemplate(combined_expression);
337
+ expansion = template.expand(data.values);
338
+ equal(expansion, combined_expansion, type + ": combined");
339
+ });
340
+ })(i, levels[i]);
341
+ }
342
+ test("Data Callbacks", function() {
343
+ var template = new URITemplate("{var}"),
344
+ global = function(key) {
345
+ var data = {"var": "hello world.html"};
346
+ return data[key];
347
+ },
348
+ local = function(key) {
349
+ return "hello world.html";
350
+ };
351
+
352
+ equal(template.expand(global), "hello%20world.html", "global callback");
353
+ equal(template.expand({"var": local}), "hello%20world.html", "local callback");
354
+ });
355
+
356
+ test("Parse errors", function() {
357
+ raises(function() {
358
+ URITemplate("AB{var$}IJ").parse();
359
+ }, Error, "Failing invalid variable name");
360
+
361
+ raises(function() {
362
+ URITemplate("AB{$var}IJ").parse();
363
+ }, Error, "Failing invalid operator");
364
+
365
+ raises(function() {
366
+ URITemplate("AB{var:3IJ").parse();
367
+ }, Error, "Failing missing closing }");
368
+
369
+ raises(function() {
370
+ URITemplate("AB{var:3*}IJ").parse();
371
+ }, Error, "Failing invalid modifier");
372
+ });
373
+
374
+ test("noConflict mode", function() {
375
+ var actual_lib = URITemplate; // actual library; after loading, before noConflict()
376
+ var unconflicted = URITemplate.noConflict();
377
+
378
+ strictEqual( unconflicted, actual_lib, "noConflict() returns the URITemplate object" );
379
+ strictEqual( URITemplate, URITemplate_pre_lib, "noConflict() restores the `URITemplate` variable" );
380
+
381
+ // restore for other tests
382
+ window.URITemplate = actual_lib;
383
+ });
384
+
385
+ })();