Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9582751
field-type.color.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
field-type.color.test.js
View Options
var
Sealious
=
require
(
"sealious"
);
module
.
exports
=
{
test_init
:
function
()
{},
test_start
:
function
()
{
var
field_type_color
=
Sealious
.
ChipManager
.
get_chip
(
"field_type"
,
"color"
);
describe
(
"FieldType.Color"
,
function
()
{
it
(
"checks if is_proper_value throws an error (wrong value)"
,
function
(
done
)
{
field_type_color
.
is_proper_value
(
new
Sealious
.
Context
(),
{},
"aaaa"
)
.
then
(
function
()
{
done
(
new
Error
(
"It didn't throw an error"
));
})
.
catch
(
function
(
error
){
done
();
})
})
it
(
"checks if is_proper_value works correctly (given \"rgb(255, 255, 255)\""
,
function
(
done
)
{
field_type_color
.
is_proper_value
(
new
Sealious
.
Context
(),
{},
"rgb(255, 255, 255)"
)
.
then
(
function
()
{
done
();
})
.
catch
(
function
(
error
){
done
(
new
Error
(
error
));
})
})
it
(
"checks if is_proper_value works correctly (given \"black\""
,
function
(
done
)
{
field_type_color
.
is_proper_value
(
new
Sealious
.
Context
(),
{},
"black"
)
.
then
(
function
()
{
done
();
})
.
catch
(
function
(
error
){
done
(
new
Error
(
error
));
})
})
it
(
"checks if is_proper_value works correctly (given \"BLACK\""
,
function
(
done
)
{
field_type_color
.
is_proper_value
(
new
Sealious
.
Context
(),
{},
"BLACK"
)
.
then
(
function
()
{
done
();
})
.
catch
(
function
(
error
){
done
(
new
Error
(
error
));
})
})
it
(
"checks if is_proper_value works correctly (given \"#000000\""
,
function
(
done
)
{
field_type_color
.
is_proper_value
(
new
Sealious
.
Context
(),
{},
"#000000"
)
.
then
(
function
()
{
done
();
})
.
catch
(
function
(
error
){
done
(
new
Error
(
error
));
})
})
it
(
"checks if is_proper_value works correctly (given \"{r: 255, g: 255, b: 255}\""
,
function
(
done
)
{
field_type_color
.
is_proper_value
(
new
Sealious
.
Context
(),
{},
{
r
:
255
,
g
:
255
,
b
:
255
})
.
then
(
function
()
{
done
();
})
.
catch
(
function
(
error
){
done
(
new
Error
(
error
));
})
})
it
(
"checks if is_proper_value works correctly (given \"hsla(262, 59%, 81%, 0.5)\""
,
function
(
done
)
{
field_type_color
.
is_proper_value
(
new
Sealious
.
Context
(),
{},
"hsla(262, 59%, 81%, 0.5)"
)
.
then
(
function
()
{
done
();
})
.
catch
(
function
(
error
){
done
(
new
Error
(
error
));
})
})
it
(
"checks if encode works correctly"
,
function
(
done
){
if
(
field_type_color
.
declaration
.
encode
(
new
Sealious
.
Context
(),
{},
{
r
:
0
,
g
:
0
,
b
:
0
})
===
"#000000"
)
done
();
else
done
(
"It didnt work correctly"
);
})
it
(
"checks if encode works correctly"
,
function
(
done
){
if
(
field_type_color
.
declaration
.
encode
(
new
Sealious
.
Context
(),
{},
"black"
)
===
"#000000"
)
done
();
else
done
(
"It didnt work correctly"
);
})
it
(
"checks if encode works correctly"
,
function
(
done
){
if
(
field_type_color
.
declaration
.
encode
(
new
Sealious
.
Context
(),
{},
"hsl(0,0%,0%)"
)
===
"#000000"
)
done
();
else
done
(
"It didnt work correctly"
);
})
})
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 11, 07:42 (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
983990
Default Alt Text
field-type.color.test.js (2 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment