-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
108 lines (95 loc) · 4.01 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>GS1 Digital Link Resolver Test Suite</title>
<script src="GS1DigitalLinkToolkit.js"></script>
<script src="GS1DigitalLinkResolverTestSuite.js"></script>
<link rel="stylesheet" href="GS1DigitalLinkResolverTestSuiteStyles.css"/>
<style type="text/css">
#dlEgInput
{
margin : 1em;
}
</style>
</head>
<body>
<header id="corporateHead"><h1>GS1 Digital Link Test Suite</h1>
<p>Conformance tests <a href="Conformance.txt">GS1 Digital Link version 1.1</a>.</p>
</header>
<main>
<img alt="rotating circle showing tests are running" id="rotatingcircle" src="rotatingcircle.gif" height="40" style="visibility: hidden">
<!-- You need an element (any kind of element) in your page with an id that is used by the test suite. If you use a different id, you'll need to update the const in the JS library accordingly -->
<section id="gs1ResolverTests"></section>
<p style="clear:both">Please report any bugs in this test suite by raising an issue in its <a href="https://github.com/gs1/GS1DL-resolver-testsuite">GitHub repository</a>.</p>
</main>
<script>
// This is just needed for this demo page, it's not part of the actual test suite.
window.onload = setUpForm;
function setUpForm()
{
// Set up the form to ask for a GS1 Digital Link
let div = document.createElement('div');
div.id = 'inputDiv';
let p = document.createElement('p');
let dlVersionButton = document.createElement('input');
dlVersionButton.id = '_1_1';
dlVersionButton.type = 'radio';
dlVersionButton.name = 'version';
dlVersionButton.value = '1.1';
let versionLabel = document.createElement('label');
versionLabel.htmlFor = '_1_1';
let t = document.createTextNode('Test HTTP Link headers');
versionLabel.appendChild(t);
versionLabel.appendChild(dlVersionButton);
p.appendChild(versionLabel);
dlVersionButton = document.createElement('input');
dlVersionButton.id = '_1_2';
dlVersionButton.type = 'radio';
dlVersionButton.name = 'version';
dlVersionButton.value = '1.2';
dlVersionButton.checked = true;
versionLabel = document.createElement('label');
versionLabel.htmlFor = '_1_2';
t = document.createTextNode('Test Linkset');
versionLabel.appendChild(t);
versionLabel.appendChild(dlVersionButton);
p.appendChild(versionLabel);
div.appendChild(p);
let dlExampleInput = document.createElement('input');
dlExampleInput.size = 40;
dlExampleInput.id = 'dlEgInput';
dlExampleInput.value = 'https://id.gs1.org/01/09506000134369';
dlExampleInput.className = 'dlTestSuiteTextInput';
let dlExampleInputLabel = document.createElement('label');
dlExampleInputLabel.for = dlExampleInput.id;
dlExampleInputLabel.className = 'dlTestSuiteTextLabel';
t = document.createTextNode('Sample Digital Link URI in your resolver (uncompressed):');
dlExampleInputLabel.appendChild(t);
dlExampleInputLabel.appendChild(dlExampleInput);
let submitButton = document.createElement('button');
submitButton.id = 'submitButton';
submitButton.addEventListener('click', function ()
{
rotatingCircle(true);
let versionNumber = '';
let ele = document.getElementsByName('version');
for (let version of ele)
{
if (version.checked)
{
versionNumber = version.value
}
}
testDL(dlExampleInput.value, versionNumber);
}, false);
t = document.createTextNode('Begin test');
submitButton.appendChild(t);
div.appendChild(dlExampleInputLabel);
div.appendChild(submitButton);
let g = document.getElementById(outputElement);
g.appendChild(div);
}
</script>
</body>
</html>