[verified] Snake 0.7: queued controls, records, pause and wrap mode
This commit is contained in:
+3
-3
@@ -6,11 +6,11 @@ const snake = require('../src/common/snake.js');
|
||||
|
||||
const ux = fs.readFileSync('src/pages/index/index.ux', 'utf8');
|
||||
const body = ux.match(/<script>([\s\S]*?)<\/script>/)[1]
|
||||
.replace(/import\s+snake\s+from\s+'[^']*';?/, '')
|
||||
.replace(/import\s+\w+\s+from\s+'[^']*';?/g, '')
|
||||
.replace(/^const\s+\w+\s*=[^\n]*\n/gm, '')
|
||||
.replace('export default', '');
|
||||
|
||||
const sandbox = { snake, Date, Math, String, Number, console, setInterval: () => 0, clearInterval: () => {},
|
||||
const sandbox = { best: require('../src/common/best.js'), storage: {get() {}, set() {}}, snake, Date, Math, String, Number, console, setInterval: () => 0, clearInterval: () => {},
|
||||
CELL: 20, GRID: 16, OFFSET: 73 };
|
||||
vm.createContext(sandbox);
|
||||
const spec = vm.runInContext('(' + body + ')', sandbox);
|
||||
@@ -60,7 +60,7 @@ assert.equal(c.model.length, 3);
|
||||
assert.equal(c.scoreText, 'SCORE 0');
|
||||
|
||||
// template uses image components for textures + documented directives/events
|
||||
assert.match(ux, /<image class="board" src="\/common\/tex\/board\.png">/);
|
||||
assert.match(ux, /<image class="board" src="\/common\/tex\/board\.png"[^>]*>/);
|
||||
assert.match(ux, /<image class="seg" src="\{\{ seg\.src \}\}"/);
|
||||
assert.match(ux, /for="\{\{ seg in snake \}\}"/);
|
||||
assert.match(ux, /show="\{\{ over \}\}"/);
|
||||
|
||||
Reference in New Issue
Block a user