Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·42 lines (36 loc) · 1.51 KB
/
Copy pathindex.html
File metadata and controls
executable file
·42 lines (36 loc) · 1.51 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Finite State Machine Tests - USING REQUIREJS INCLUDE MECHANISM</title>
<link rel="stylesheet" href="../qunit/qunit.css" media="screen">
<script src="../qunit/qunit.js"></script>
<script src="require.js"></script>
<script>
require(["../../state-machine.js"], function(StateMachine) {
test("state machine included using require.js", function() {
var fsm = StateMachine.create({
initial: 'green',
events: [
{ name: 'warn', from: 'green', to: 'yellow' },
{ name: 'panic', from: 'yellow', to: 'red' },
{ name: 'calm', from: 'red', to: 'yellow' },
{ name: 'clear', from: 'yellow', to: 'green' }
]});
equal(fsm.current, 'green', "initial state should be green");
fsm.warn(); equal(fsm.current, 'yellow', "warn event should transition from green to yellow");
fsm.panic(); equal(fsm.current, 'red', "panic event should transition from yellow to red");
fsm.calm(); equal(fsm.current, 'yellow', "calm event should transition from red to yellow");
fsm.clear(); equal(fsm.current, 'green', "clear event should transition from yellow to green");
});
});
</script>
</head>
<body class="flora">
<h1 id="qunit-header">QUnit Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup</div>
</body>
</html>