summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-supports.html
blob: 495056fce9ade1d8ffb9568c0b2695c7f14c7342 (plain)
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
<!doctype html>
<meta charset=utf-8>
<title>HTMLScriptElement.supports</title>
<link rel=help href="https://html.spec.whatwg.org/#dom-script-supports">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
  assert_equals(typeof HTMLScriptElement.supports, 'function');
}, 'Type of HTMLScriptElement.supports is function');

test(function() {
  assert_true(HTMLScriptElement.supports('classic'));
}, 'HTMLScriptElement.supports resurns true for \'classic\'');

test(function() {
  assert_true(HTMLScriptElement.supports('module'));
}, 'HTMLScriptElement.supports resurns true for \'module\'');

test(function() {
  assert_false(HTMLScriptElement.supports('application/ecmascript'));
  assert_false(HTMLScriptElement.supports('application/javascript'));
  assert_false(HTMLScriptElement.supports('application/x-ecmascript'));
  assert_false(HTMLScriptElement.supports('application/x-javascript'));
  assert_false(HTMLScriptElement.supports('text/ecmascript'));
  assert_false(HTMLScriptElement.supports('text/javascript'));
  assert_false(HTMLScriptElement.supports('text/javascript1.0'));
  assert_false(HTMLScriptElement.supports('text/javascript1.1'));
  assert_false(HTMLScriptElement.supports('text/javascript1.2'));
  assert_false(HTMLScriptElement.supports('text/javascript1.3'));
  assert_false(HTMLScriptElement.supports('text/javascript1.4'));
  assert_false(HTMLScriptElement.supports('text/javascript1.5'));
  assert_false(HTMLScriptElement.supports('text/jscript'));
  assert_false(HTMLScriptElement.supports('text/livescript'));
  assert_false(HTMLScriptElement.supports('text/x-ecmascript'));
  assert_false(HTMLScriptElement.supports('text/x-javascript'));
}, 'HTMLScriptElement.supports returns false for JavaScript MIME types');

test(function() {
  assert_false(HTMLScriptElement.supports(''));
  assert_false(HTMLScriptElement.supports(' '));
  assert_false(HTMLScriptElement.supports('classic '));
  assert_false(HTMLScriptElement.supports('module '));
  assert_false(HTMLScriptElement.supports(' classic '));
  assert_false(HTMLScriptElement.supports(' module '));
  assert_false(HTMLScriptElement.supports('classics'));
  assert_false(HTMLScriptElement.supports('modules'));
  assert_false(HTMLScriptElement.supports('Classic'));
  assert_false(HTMLScriptElement.supports('Module'));
  assert_false(HTMLScriptElement.supports('unsupported'));
}, 'HTMLScriptElement.supports returns false for unsupported types');
</script>