Added tests for Toggles
This commit is contained in:
46
test/t_Config/t_Toggles/t_ToggleGCTimer.js
Normal file
46
test/t_Config/t_Toggles/t_ToggleGCTimer.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import { before, beforeEach, describe, it } from 'mocha';
|
||||
import { assert } from 'chai';
|
||||
import { l } from '../../GlobalsForTesting';
|
||||
|
||||
import { CMOptions } from '../../../src/Config/VariablesAndData';
|
||||
import ToggleGCTimer from '../../../src/Config/Toggles/ToggleGCTimer';
|
||||
import { GCTimers } from '../../../src/Disp/VariablesAndData';
|
||||
import { CacheGoldenShimmersByID } from '../../../src/Cache/VariablesAndData';
|
||||
|
||||
describe('ToggleGCTimer', function () {
|
||||
global.l = l;
|
||||
|
||||
beforeEach(function () {
|
||||
global.domids = {};
|
||||
GCTimers[0] = { style: {} };
|
||||
GCTimers[1] = { style: {} };
|
||||
CacheGoldenShimmersByID[0] = {
|
||||
l: { style: { left: 'Test00', top: 'Test01' } },
|
||||
};
|
||||
CacheGoldenShimmersByID[1] = {
|
||||
l: { style: { left: 'Test10', top: 'Test11' } },
|
||||
};
|
||||
ToggleGCTimer();
|
||||
});
|
||||
|
||||
describe('GCTimer = 0', function () {
|
||||
before(function () {
|
||||
CMOptions.GCTimer = 0;
|
||||
});
|
||||
it('Toggle style correctly', function () {
|
||||
assert.equal(GCTimers[0].style.display, 'none');
|
||||
assert.equal(GCTimers[1].style.display, 'none');
|
||||
});
|
||||
});
|
||||
describe('GCTimer = 1', function () {
|
||||
before(function () {
|
||||
CMOptions.GCTimer = 1;
|
||||
});
|
||||
it('Toggle style correctly', function () {
|
||||
assert.equal(GCTimers[0].style.display, 'block');
|
||||
assert.equal(GCTimers[0].style.left, 'Test00');
|
||||
assert.equal(GCTimers[0].style.top, 'Test01');
|
||||
assert.equal(GCTimers[1].style.display, 'block');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user