rbbt-rest 1.6.8 → 1.6.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,325 @@
1
+ var vows = require('vows'),
2
+ assert = require('assert'),
3
+ color = require('../color');
4
+
5
+ var Color = color.Color;
6
+
7
+ assert.colorEqual = function(color1, color2) {
8
+ assert.deepEqual(color1.toRGB(), color2.toRGB());
9
+ };
10
+
11
+ function validCSS(bool) {
12
+ var context = {
13
+ topic: function() {
14
+ return this.context.name.match(/"(.*)"/)[1];
15
+ }
16
+ };
17
+
18
+ var shouldString = (bool ? 'should' : 'shouldn\'t') + ' be a valid CSS color';
19
+
20
+ context[shouldString] = function(colorString) {
21
+ var valid = Color.isValid(colorString);
22
+ assert.equal(valid, bool);
23
+ };
24
+
25
+ return context;
26
+ }
27
+
28
+ vows.describe('Color').addBatch({
29
+ // Parsing:
30
+ 'A color built from the CSS string': {
31
+ '#f00': {
32
+ topic: Color('#f00'),
33
+
34
+ 'should be equal to RGB(R=1; G=0; B=0; ALPHA=1)': function(color) {
35
+ assert.colorEqual( color,
36
+ Color({ red: 1,
37
+ green: 0,
38
+ blue: 0,
39
+ alpha: 1 }) );
40
+ }
41
+ },
42
+ '#f0f000': {
43
+ topic: Color('#f0f000'),
44
+ 'should be equal to RGB(R=240/255; G=240/255; B=0; ALPHA=1)': function(color) {
45
+ assert.colorEqual( color,
46
+ Color({ red: 240/255,
47
+ green: 240/255,
48
+ blue: 0,
49
+ alpha: 1 }) );
50
+ }
51
+ },
52
+ 'rgb(0, 23, 42)': {
53
+ topic: Color('rgb(0, 23, 42)'),
54
+
55
+ 'should be equal to RGB(R=0; G=23/255; B=42/255; ALPHA=1)': function(color) {
56
+ assert.colorEqual( color,
57
+ Color({ red: 0,
58
+ green: 23/255,
59
+ blue: 42/255,
60
+ alpha: 1 }) );
61
+ },
62
+ 'should be equal to \'rgba(0, 23, 42, 1)\'': function(color) {
63
+ assert.colorEqual( color,
64
+ Color('rgba(0, 23, 42, 1)') );
65
+ }
66
+ },
67
+ 'rgb( 0% , 9%, 16% )': {
68
+ topic: Color('rgb( 0% , 9%, 16% )'),
69
+
70
+ 'should be equal to RGB(R=0; G=0.09; B=0.16; ALPHA=1)': function(color) {
71
+ assert.colorEqual(color,
72
+ Color({ red: 0,
73
+ green: .09,
74
+ blue: .16,
75
+ alpha: 1 }) );
76
+ },
77
+ 'should be equal to \'rgba(0%,9%,16%,1)\'': function(color) {
78
+ assert.colorEqual(color,
79
+ Color('rgba(0%,9%,16%,1)'));
80
+ }
81
+ },
82
+ 'rgba( 255, 0, 0, .45 )': {
83
+ topic: Color('rgba( 255, 0, 0, .45 )'),
84
+
85
+ 'should be equal to RGB(R=1; G=0: B=0; ALPHA=0.45)': function (color) {
86
+ assert.colorEqual(color,
87
+ Color({ red: 1,
88
+ green: 0,
89
+ blue: 0,
90
+ alpha: .45 }) );
91
+ }
92
+ },
93
+ 'hsl(203, 50%, 40%)': {
94
+ topic: Color('hsl(203, 50%, 40%)'),
95
+
96
+ 'should be equal to HSL(H=203; S=0.5; L=40%; ALPHA=1)': function(color) {
97
+ assert.colorEqual( color,
98
+ Color({ hue: 203,
99
+ saturation: .5,
100
+ lightness: .4,
101
+ alpha: 1 }));
102
+ },
103
+ 'should be equal to \'hsla(563, 50%, 40%, 2)\'': function(color) {
104
+ assert.colorEqual( color,
105
+ Color('hsla(563, 50%, 40%, 2)'));
106
+ }
107
+ },
108
+ 'hsla(203, 50%, 40%, .48)': {
109
+ topic: Color('hsla(203, 50%, 40%, .48)'),
110
+
111
+ 'should be equal to HSL(H=203; S=0.5; L=40%; ALPHA=0.48)': function(color) {
112
+ assert.colorEqual( color,
113
+ Color({ hue: 203,
114
+ saturation: .5,
115
+ lightness: .4,
116
+ alpha: .48 }));
117
+ }
118
+ },
119
+ 'darkseagreen': {
120
+ topic: Color('darkseagreen'),
121
+
122
+ 'should be equal to `Color(\'#8FBC8F\')`': function(color) {
123
+ assert.colorEqual(color, Color('#8FBC8F'));
124
+ },
125
+ 'shouldn\'t be case-sensitive': function(color) {
126
+ assert.deepEqual(Color('dArKsEaGrEeN'), color);
127
+ }
128
+ }
129
+ },
130
+ // Conversion:
131
+ 'An RGB color (R=1; G=0.5; B=0; ALPHA=.49)': {
132
+ topic: Color({ red: 1,
133
+ green: .5,
134
+ blue: 0,
135
+ alpha: .49 }),
136
+
137
+ 'converted to HSV should be equal to HSV(H=30; S=1; V=1; ALPHA=0.49)': function(color) {
138
+ assert.deepEqual(color.toHSV(), Color({ hue: 30,
139
+ saturation: 1,
140
+ value: 1,
141
+ alpha: .49 }));
142
+ },
143
+ 'converted to HSL should be equal to HSL(H=30; S=1; L=0.5; ALPHA=0.49)': function(color) {
144
+ assert.deepEqual( color.toHSL(), Color({ hue: 30,
145
+ saturation: 1,
146
+ lightness: .5,
147
+ alpha: .49 }) );
148
+ }
149
+ },
150
+ 'A HSV color (H=180; S=1; V=0.5; ALPHA=0.69)': {
151
+ topic: Color({ hue: 180,
152
+ saturation: 1,
153
+ value: .5,
154
+ alpha: .69 }),
155
+
156
+ 'converted to RGB should be equal to RGB(R=0; G=0.5; B=0.5; ALPHA=0.69)': function(color) {
157
+ assert.deepEqual(color.toRGB(), Color({ red: 0,
158
+ green: .5,
159
+ blue: .5,
160
+ alpha: .69 }));
161
+ },
162
+ 'converted to HSL should be equal to HSL(H=180; S=1; L=0.25; ALPHA=0.69)': function(color) {
163
+ assert.deepEqual( color.toHSL(), Color({ hue: 180,
164
+ saturation: 1,
165
+ lightness: .25,
166
+ alpha: .69 }) );
167
+ }
168
+ },
169
+ 'A HSL color (H=0; S=0.25; L=0.25; ALPHA=0.81)': {
170
+ topic: Color({ hue: 0,
171
+ saturation: .25,
172
+ lightness: .25,
173
+ alpha: .81 }),
174
+ 'converted to RGB should be equal to RGB(R=0.3125; G=0.1875; B=0.1875; ALPHA=0.81)': function(color) {
175
+ assert.deepEqual( color.toRGB(), Color({ red: .3125,
176
+ green: .1875,
177
+ blue: .1875,
178
+ alpha: .81 }) );
179
+ },
180
+ 'converted to HSV should be equal to HSV(H=0; S=0.4; V=0.3125; ALPHA=0.81)': function(color) {
181
+ assert.deepEqual( color.toHSV(), Color({ hue: 0,
182
+ saturation: .4,
183
+ value: .3125,
184
+ alpha: .81 }) );
185
+ }
186
+ },
187
+ 'Converting RGB(R=0.75; G=0.75; B=0.75; ALPHA=.45) to a hex string': {
188
+ topic: Color({ red: .75,
189
+ green: .75,
190
+ blue: .75,
191
+ alpha: .45 }).toCSS(),
192
+
193
+ 'should result in the string \'#BFBFBF\'': function(cssColor) {
194
+ assert.equal(cssColor, 'rgba(191,191,191,0.45)');
195
+ }
196
+ },
197
+ 'A color RGB (R=0; G=1; B=0) blended with 60% RGB(R=0; G=0; B=1)': {
198
+ topic: Color({ red: 0,
199
+ green: 1,
200
+ blue: 0 }).blend(Color({ red: 0,
201
+ green: 0,
202
+ blue: 1 }), .6),
203
+
204
+ 'should result in RGB (R=0; G=0.4; B=0.6)': function(color) {
205
+ assert.colorEqual(color, Color({ red: 0,
206
+ green: .4,
207
+ blue: .6 }));
208
+ }
209
+ },
210
+ 'The luminance of': {
211
+ 'RGB(R=1; G=1; B=1) (white)': {
212
+ topic: Color({ red: 1,
213
+ green: 1,
214
+ blue: 1 }).getLuminance(),
215
+
216
+ 'should be equal to 1': function(luminance) {
217
+ assert.equal(luminance, 1);
218
+ }
219
+ },
220
+ 'RGB(R=0; G=0; B=0) (black)': {
221
+ topic: Color({ red: 0,
222
+ green: 0,
223
+ blue: 0 }).getLuminance(),
224
+
225
+ 'should be equal to 0': function(luminance) {
226
+ assert.equal(luminance, 0);
227
+ }
228
+ }
229
+ },
230
+ 'The complementary color of RGB(R=1; G=0; B=0)': {
231
+ topic: Color({ red: 1,
232
+ green: 0,
233
+ blue: 0 }).complementaryScheme()[1].toRGB(),
234
+ 'should be RGB(R=0; G=1; B=0) (cyan)': function(color) {
235
+ assert.colorEqual( color,
236
+ Color({ red: 0,
237
+ green: 1,
238
+ blue: 1 }) );
239
+ }
240
+ },
241
+ 'HSV(H=90; S=0.5; V=0.5)': {
242
+ topic: Color({ hue: 90,
243
+ saturation: .5,
244
+ value: .5 }),
245
+ 'increase value by 1000% should be equal to HSV(H=90; S=0.5; V=1)': function(color) {
246
+ assert.colorEqual( color.valueByRatio(10),
247
+ Color({ hue: 90,
248
+ saturation: .5,
249
+ value: 1 }));
250
+ },
251
+ 'increase value by 0.1 should be equal to HSV(H=90; S=0.5; V=0.6)': function(color) {
252
+ assert.colorEqual( color.valueByAmount(.1),
253
+ Color({ hue: 90,
254
+ saturation: .5,
255
+ value: .6 }) );
256
+ },
257
+ 'devalue by 50% should be equal to HSV(H=90; S=0.5; V=0.25)': function(color) {
258
+ assert.colorEqual( color.devalueByRatio(.5),
259
+ Color({ hue: 90,
260
+ saturation: .5,
261
+ value: .25 }) );
262
+ },
263
+ 'devalue by 2.3 should be equal to HSV(H=90; S=0.5; V=0)': function(color) {
264
+ assert.colorEqual( color.devalueByAmount(2.3),
265
+ Color({ hue: 90,
266
+ saturation: .5,
267
+ value: 0 }) );
268
+ },
269
+ 'saturated by 2% should be equal to HSV(H=90; S=0.51; V=0.5)': function(color) {
270
+ assert.colorEqual( color.saturateByRatio(.02),
271
+ Color({ hue: 90,
272
+ saturation: .51,
273
+ value: .5 }) );
274
+ },
275
+ 'saturated by -0.1 should be equal to HSV(H=90; S=0.4; V=0.5)': function(color) {
276
+ assert.colorEqual( color.saturateByAmount(-.1),
277
+ Color({ hue: 90,
278
+ saturation: .4,
279
+ value: .5 }) );
280
+ },
281
+ 'desaturated by 50% should be equal to HSV(H=90; S=0.25; V=0.5)': function(color) {
282
+ assert.colorEqual( color.desaturateByRatio(.5),
283
+ Color({ hue: 90,
284
+ saturation: .25,
285
+ value: .5 }) );
286
+ },
287
+ 'desaturated by -2.3 should be equal to HSV(H=90; S=1; V=0.5)': function(color) {
288
+ assert.colorEqual( color.desaturateByAmount(-2.3),
289
+ Color({ hue: 90,
290
+ saturation: 1,
291
+ value: .5 }) );
292
+ },
293
+ 'hue shifted by 359 degrees should be equal to HSV(H=89; S=0.5; V=0.5)': function(color) {
294
+ assert.colorEqual( color.shiftHue(359),
295
+ Color({ hue: 89,
296
+ saturation: .5,
297
+ value: .5 }) );
298
+ }
299
+ },
300
+ '"rgb(55, 111, 222)"': validCSS(true),
301
+ '"rgb(2.2, 3.3, 127.3 )"': validCSS(false),
302
+ '"rgb(1, 2, 3, 4)"': validCSS(false),
303
+ '"rgb(aa, 22, 44)"': validCSS(false),
304
+ '"rgb(-100, 300, +137)"': validCSS(true),
305
+ '"rgb(100%, 50%, 30%)"': validCSS(true),
306
+ '"rgb(88.8%, +111%, -30%)"': validCSS(true),
307
+ '"rgb(2 %, 2%, 2%)"': validCSS(false),
308
+ '"rgb(33%, 22%, 11)"': validCSS(false),
309
+ '"rgba(42, 24, 42, 0)"': validCSS(true),
310
+ '"rgba(42, 24, 42, 1)"': validCSS(true),
311
+ '"rgba(42, 24, 42, 2)"': validCSS(true),
312
+ '"rgba(1, 2, 3)"': validCSS(false),
313
+ '"rgba(11, 22, 33, -.5)"': validCSS(true),
314
+ '"rgba(33%, 50%, )"': validCSS(false),
315
+ '"#f00"': validCSS(true),
316
+ '"f00"': validCSS(false),
317
+ '"#00AA00"': validCSS(true),
318
+ '"#00aAAA999"': validCSS(false),
319
+ '"hsl(300.3, 100%, 50%)"': validCSS(true),
320
+ '"hsl(-300.3, 110%, -50%)"': validCSS(true),
321
+ '"hsla(-300.3, 110%, -50%)"': validCSS(false),
322
+ '"hsla(-300.3, 110%, -50%, 3)"': validCSS(true),
323
+ '"seagreen"': validCSS(true),
324
+ '"transparent"': validCSS(true)
325
+ }).export(module);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.8
4
+ version: 1.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -367,14 +367,18 @@ files:
367
367
  - share/views/public/js/jquery-ui.js
368
368
  - share/views/public/js/ng-favourites.js
369
369
  - share/views/public/js/rbbt.aesthetics.js
370
+ - share/views/public/js/rbbt.basic.js
370
371
  - share/views/public/js/rbbt.entity.js
371
372
  - share/views/public/js/rbbt.entity_list.js
372
373
  - share/views/public/js/rbbt.entity_map.js
373
374
  - share/views/public/js/rbbt.favourites.js
374
375
  - share/views/public/js/rbbt.favourites.js.old
376
+ - share/views/public/js/rbbt.job.js
375
377
  - share/views/public/js/rbbt.js
376
378
  - share/views/public/js/rbbt.knowledge_base.js
379
+ - share/views/public/js/rbbt.modal.js
377
380
  - share/views/public/js/rbbt.page.js
381
+ - share/views/public/js/rbbt.views.js
378
382
  - share/views/public/js/rbbt/actions.js
379
383
  - share/views/public/js/rbbt/dom_update.js
380
384
  - share/views/public/js/rbbt/favourites.js
@@ -390,6 +394,11 @@ files:
390
394
  - share/views/public/js/rbbt/workflow.js
391
395
  - share/views/public/plugins/FileSaver/js/FileSaver.js
392
396
  - share/views/public/plugins/angular/angular.js
397
+ - share/views/public/plugins/color-js/LICENSE
398
+ - share/views/public/plugins/color-js/README.markdown
399
+ - share/views/public/plugins/color-js/color.d.ts
400
+ - share/views/public/plugins/color-js/color.js
401
+ - share/views/public/plugins/color-js/test/color-test.js
393
402
  - share/views/public/plugins/cytoscapejs/arbor.js
394
403
  - share/views/public/plugins/cytoscapejs/cytoscape.js
395
404
  - share/views/public/plugins/d3js/d3js.min.js