4 https://bugzilla.mozilla.org/show_bug.cgi?id=1079453
8 <title>Test for Bug
1079453</title>
9 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
11 <script src=
"common.js"></script>
15 * https://w3c.github.io/manifest/#orientation-member
19 typeTests
.forEach((type
) => {
20 var expected
= `Expect non-string orientation to be empty string : ${typeof type}.`;
21 data
.jsonText
= JSON
.stringify({
24 var result
= processor
.process(data
);
25 is(result
.orientation
, undefined, expected
);
28 var validOrientations
= [
36 "landscape-secondary",
44 "LANDSCAPE-secondary",
47 validOrientations
.forEach((orientation
) => {
48 var expected
= `Expect orientation to be returned: ${orientation}.`;
49 data
.jsonText
= JSON
.stringify({ orientation
});
50 var result
= processor
.process(data
);
51 is(result
.orientation
, orientation
.toLowerCase(), expected
);
54 var invalidOrientations
= [
58 "portrait-primary portrait-secondary",
59 "portrait-primary,portrait-secondary",
64 "landscape-landscape",
68 invalidOrientations
.forEach((orientation
) => {
69 var expected
= `Expect orientation to be empty string: ${orientation}.`;
70 data
.jsonText
= JSON
.stringify({ orientation
});
71 var result
= processor
.process(data
);
72 is(result
.orientation
, undefined, expected
);
76 validOrientations
.forEach((orientation
) => {
77 var expected
= `Expect trimmed orientation to be returned.`;
78 var expandedOrientation
= `${seperators}${lineTerminators}${orientation}${lineTerminators}${seperators}`;
79 data
.jsonText
= JSON
.stringify({
80 orientation
: expandedOrientation
,
82 var result
= processor
.process(data
);
83 is(result
.orientation
, orientation
.toLowerCase(), expected
);