mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1240735 - Add tests for theme_color and background_color members. r=baku
This commit is contained in:
parent
5b5f27011a
commit
f7599ebdd2
@ -8,6 +8,7 @@ support-files =
|
||||
[test_ImageObjectProcessor_sizes.html]
|
||||
[test_ImageObjectProcessor_src.html]
|
||||
[test_ImageObjectProcessor_type.html]
|
||||
[test_ManifestProcessor_background_color.html]
|
||||
[test_ManifestProcessor_display.html]
|
||||
[test_ManifestProcessor_icons.html]
|
||||
[test_ManifestProcessor_JSON.html]
|
||||
@ -17,4 +18,5 @@ support-files =
|
||||
[test_ManifestProcessor_scope.html]
|
||||
[test_ManifestProcessor_splash_screens.html]
|
||||
[test_ManifestProcessor_start_url.html]
|
||||
[test_ManifestProcessor_theme_color.html]
|
||||
[test_ManifestProcessor_warnings.html]
|
||||
|
@ -0,0 +1,94 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1195018
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1195018</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>
|
||||
/**
|
||||
* background_color member
|
||||
* https://w3c.github.io/manifest/#background_color-member
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
typeTests.forEach(type => {
|
||||
data.jsonText = JSON.stringify({
|
||||
background_color: type
|
||||
});
|
||||
var result = processor.process(data);
|
||||
|
||||
is(result.background_color, undefined, `Expect non-string background_color to be undefined: ${typeof type}.`);
|
||||
});
|
||||
|
||||
var validThemeColors = [
|
||||
'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)',
|
||||
];
|
||||
|
||||
validThemeColors.forEach(background_color => {
|
||||
data.jsonText = JSON.stringify({
|
||||
background_color: background_color
|
||||
});
|
||||
var result = processor.process(data);
|
||||
|
||||
is(result.background_color, background_color, `Expect background_color to be returned: ${background_color}.`);
|
||||
});
|
||||
|
||||
var invalidThemeColors = [
|
||||
'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}',
|
||||
]
|
||||
|
||||
invalidThemeColors.forEach(background_color => {
|
||||
data.jsonText = JSON.stringify({
|
||||
background_color: background_color
|
||||
});
|
||||
var result = processor.process(data);
|
||||
|
||||
is(result.background_color, undefined, `Expect background_color to be undefined: ${background_color}.`);
|
||||
});
|
||||
|
||||
// Trim tests
|
||||
validThemeColors.forEach(background_color => {
|
||||
var expandedThemeColor = `${seperators}${lineTerminators}${background_color}${lineTerminators}${seperators}`;
|
||||
data.jsonText = JSON.stringify({
|
||||
background_color: expandedThemeColor
|
||||
});
|
||||
var result = processor.process(data);
|
||||
|
||||
is(result.background_color, background_color, `Expect trimmed background_color to be returned.`);
|
||||
});
|
||||
</script>
|
||||
</head>
|
94
dom/manifest/test/test_ManifestProcessor_theme_color.html
Normal file
94
dom/manifest/test/test_ManifestProcessor_theme_color.html
Normal file
@ -0,0 +1,94 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1195018
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1195018</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>
|
||||
/**
|
||||
* theme_color member
|
||||
* https://w3c.github.io/manifest/#theme_color-member
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
typeTests.forEach(type => {
|
||||
data.jsonText = JSON.stringify({
|
||||
theme_color: type
|
||||
});
|
||||
var result = processor.process(data);
|
||||
|
||||
is(result.theme_color, undefined, `Expect non-string theme_color to be undefined: ${typeof type}.`);
|
||||
});
|
||||
|
||||
var validThemeColors = [
|
||||
'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)',
|
||||
];
|
||||
|
||||
validThemeColors.forEach(theme_color => {
|
||||
data.jsonText = JSON.stringify({
|
||||
theme_color: theme_color
|
||||
});
|
||||
var result = processor.process(data);
|
||||
|
||||
is(result.theme_color, theme_color, `Expect theme_color to be returned: ${theme_color}.`);
|
||||
});
|
||||
|
||||
var invalidThemeColors = [
|
||||
'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}',
|
||||
]
|
||||
|
||||
invalidThemeColors.forEach(theme_color => {
|
||||
data.jsonText = JSON.stringify({
|
||||
theme_color: theme_color
|
||||
});
|
||||
var result = processor.process(data);
|
||||
|
||||
is(result.theme_color, undefined, `Expect theme_color to be undefined: ${theme_color}.`);
|
||||
});
|
||||
|
||||
// Trim tests
|
||||
validThemeColors.forEach(theme_color => {
|
||||
var expandedThemeColor = `${seperators}${lineTerminators}${theme_color}${lineTerminators}${seperators}`;
|
||||
data.jsonText = JSON.stringify({
|
||||
theme_color: expandedThemeColor
|
||||
});
|
||||
var result = processor.process(data);
|
||||
|
||||
is(result.theme_color, theme_color, `Expect trimmed theme_color to be returned.`);
|
||||
});
|
||||
</script>
|
||||
</head>
|
Loading…
Reference in New Issue
Block a user