Bug 1945965 – remove new tab April Fools logo. r=home-newtab-reviewers,reemhamz
[gecko.git] / dom / manifest / test / test_ManifestProcessor_orientation.html
blob9333eecbe381003f34241f0bcfe49a1711c9fbfd
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1079453
5 -->
6 <head>
7 <meta charset="utf-8">
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>
12 <script>
13 /**
14 * orientation member
15 * https://w3c.github.io/manifest/#orientation-member
16 **/
17 "use strict";
19 typeTests.forEach((type) => {
20 var expected = `Expect non-string orientation to be empty string : ${typeof type}.`;
21 data.jsonText = JSON.stringify({
22 orientation: type,
23 });
24 var result = processor.process(data);
25 is(result.orientation, undefined, expected);
26 });
28 var validOrientations = [
29 "any",
30 "natural",
31 "landscape",
32 "portrait",
33 "portrait-primary",
34 "portrait-secondary",
35 "landscape-primary",
36 "landscape-secondary",
37 "aNy",
38 "NaTuRal",
39 "LANDsCAPE",
40 "PORTRAIT",
41 "portrait-PRIMARY",
42 "portrait-SECONDARY",
43 "LANDSCAPE-primary",
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);
52 });
54 var invalidOrientations = [
55 "all",
56 "ANYMany",
57 "NaTuRalle",
58 "portrait-primary portrait-secondary",
59 "portrait-primary,portrait-secondary",
60 "any-natural",
61 "portrait-landscape",
62 "primary-portrait",
63 "secondary-portrait",
64 "landscape-landscape",
65 "secondary-primary",
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);
73 });
75 // Trim tests
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,
81 });
82 var result = processor.process(data);
83 is(result.orientation, orientation.toLowerCase(), expected);
84 });
85 </script>
86 </head>