-
Notifications
You must be signed in to change notification settings - Fork 0
/
Oppgave1q.html
90 lines (77 loc) · 2.72 KB
/
Oppgave1q.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>QUnit</title>
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.9.2.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="https://code.jquery.com/qunit/qunit-2.9.2.js"></script>
<script src="Oppgave1.js"></script>
<script>
QUnit.test("Valid date", function (assert) {
const actual = isDateValid('02.04.2020');
const expected = true;
assert.equal(actual, expected);
});
QUnit.test("Length", function (assert) {
const actual = dateLength('02.04.2020');
const expected = true;
assert.equal(actual, expected);
});
QUnit.test("Dot", function (assert) {
const actual = dateDot('02.04.2020');
const expected = true;
assert.equal(actual, expected);
});
QUnit.test("Year", function (assert) {
const actual = dateYear('2020');
const expected = true;
assert.equal(actual, expected);
});
QUnit.test("Month", function (assert) {
const actual = dateMonth('02');
const expected = true;
assert.equal(actual, expected);
});
QUnit.test("Day", function (assert) {
const actual = dateDay('28', '02', '2020');
const expected = true;
assert.equal(actual, expected);
});
QUnit.test("Leap year", function (assert) {
const actual = dateDay('29', '02', '2020');
const expected = true;
assert.equal(actual, expected);
});
QUnit.test("30", function (assert) {
const actual = dateDay('30', '04', '2020');
const expected = true;
assert.equal(actual, expected);
});
QUnit.test("31", function (assert) {
const actual = dateDay('31', '05', '2020');
const expected = true;
assert.equal(actual, expected);
});
QUnit.test("Not leap year", function (assert) {
const actual = dateDay('29', '02', '2021');
const expected = false;
assert.equal(actual, expected);
});
QUnit.test("Not 30", function (assert) {
const actual = dateDay('31', '04', '2020');
const expected = false;
assert.equal(actual, expected);
});
QUnit.test("Not 31", function (assert) {
const actual = dateDay('32', '05', '2020');
const expected = false;
assert.equal(actual, expected);
});
</script>
</body>
</html>