mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-09-10 11:54:40 +00:00
85 lines
2.1 KiB
HTML
85 lines
2.1 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1162808
|
|
-->
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for Bug 1162808</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
<script src="common.js"></script>
|
|
<script type="application/javascript">
|
|
/**
|
|
* Image object's type member
|
|
* https://w3c.github.io/manifest/#type-member
|
|
*
|
|
* Checks that invalid and valid colors are processed correctly.
|
|
**/
|
|
/*globals data, processor, is*/
|
|
'use strict';
|
|
var testIcon = {
|
|
icons: [{
|
|
src: 'test',
|
|
'background_color': undefined
|
|
}]
|
|
};
|
|
|
|
// Test invalid colors.
|
|
var invalidColors = [
|
|
'marooon',
|
|
'f000000',
|
|
'#ff00000',
|
|
'rgb(255 0 0)',
|
|
'rgb(100, 0%, 0%)',
|
|
'rgb(255,0)',
|
|
'rgb(300 0 0)',
|
|
'rbg(255,-10,0)',
|
|
'rgb(110, 0%, 0%)',
|
|
'(255,0,0) }',
|
|
'rgba(255)',
|
|
' rgb(100%,0%,0%) }',
|
|
'hsl 120, 100%, 50%',
|
|
'hsla{120, 100%, 50%, 1}'
|
|
];
|
|
invalidColors.forEach((invalidColor) => {
|
|
var expected = `Treat invalid color (${invalidColor}) as undefined.`;
|
|
testIcon.icons[0].background_color = invalidColor;
|
|
data.jsonText = JSON.stringify(testIcon);
|
|
var result = processor.process(data);
|
|
is(result.icons[0].background_color, undefined, expected);
|
|
});
|
|
|
|
// Test valid colors.
|
|
var validColors = [
|
|
'maroon',
|
|
'#f00',
|
|
'#ff0000',
|
|
'rgb(255,0,0)',
|
|
'rgb(100%, 0%, 0%)',
|
|
'rgb(255,0,0)',
|
|
'rgb(300,0,0)',
|
|
'rgb(255,-10,0)',
|
|
'rgb(110%, 0%, 0%)',
|
|
'rgb(255,0,0)',
|
|
'rgba(255,0,0,1)',
|
|
'rgb(100%,0%,0%)',
|
|
'rgba(100%,0%,0%,1)',
|
|
'rgba(0,0,255,0.5)',
|
|
'rgba(100%, 50%, 0%, 0.1)',
|
|
'hsl(120, 100%, 50%)',
|
|
'hsla(120, 100%, 50%, 1)'
|
|
];
|
|
|
|
validColors.forEach((color) => {
|
|
var expected = `Treat valid CSS color (${color}) as valid input.`;
|
|
testIcon.icons[0].background_color = color;
|
|
data.jsonText = JSON.stringify(testIcon);
|
|
var result = processor.process(data);
|
|
is(result.icons[0].background_color, color, expected);
|
|
});
|
|
</script>
|
|
</head>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1162808">Mozilla Bug 1162808</a>
|