-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload.js
70 lines (52 loc) · 1.53 KB
/
load.js
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
import 'mocha/mocha.js'
import { assert } from 'chai'
import Phaser from 'phaser'
const { mocha, Mocha } = window
mocha.setup('bdd')
const { describe: context, test, before, after, beforeEach, afterEach } = Mocha
context('Phaser', () => {
test('is an object', () => {
assert.isObject(Phaser)
})
test('is the required version', () => {
assert.propertyVal(Phaser, 'VERSION', '3.87')
})
})
context('load.scenePlugin()', () => {
let game
beforeEach((done) => {
game = new Phaser.Game({
callbacks: {
postBoot: () => {
done()
}
}
})
})
afterEach((done) => {
// biome-ignore lint/performance/noDelete: deglobalize
delete window.DisplayListWatcher
game.events.once('destroy', () => {
game = null
done()
})
game.destroy(true)
})
test('load.scenePlugin("DisplayListWatcher", "dist/display-list-watcher.umd.js") adds the plugin class to the plugin manager', (done) => {
const scene = game.scene.systemScene
scene.load
.scenePlugin('DisplayListWatcher', 'dist/display-list-watcher.umd.js')
.start()
scene.load.once('complete', (loader, totalComplete, totalFailed) => {
assert.strictEqual(totalComplete, 1)
assert.strictEqual(totalFailed, 0)
assert.property(window, 'DisplayListWatcher')
assert.isFunction(window.DisplayListWatcher)
assert.include(game.plugins.scenePlugins, 'DisplayListWatcher')
done()
})
})
})
mocha.globals(['Phaser', 'DisplayListWatcher'])
mocha.checkLeaks()
mocha.run()