Skip to content

Commit 09f9633

Browse files
update some test
1 parent 08d849a commit 09f9633

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

src/utils/api/api.factory.test.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -393,21 +393,6 @@ describe('Api.prototype.eventHandlerFactory : ', () => {
393393
}
394394
});
395395
});
396-
describe('Api.prototype.getCopyPerviouseData', () => {
397-
test('In the onLoad event, return data is equal to getInitialState() and getCopyData()', () => {
398-
expect.assertions(3);
399-
const _state = { selectedTabID: 'tab1', openTabIDs: ['tab1', 'tab2'] };
400-
obj.setOption('onLoad', function () {
401-
const perviousData = this.getCopyPerviousData();
402-
const data = this.getCopyData();
403-
expect(perviousData).toEqual(_state);
404-
expect(perviousData).toEqual(data);
405-
expect(perviousData !== null).toBe(true);
406-
});
407-
obj.updateStateRef(_state, () => { });
408-
obj.trigger('onLoad', obj.userProxy);
409-
});
410-
});
411396
describe('Api.prototype.getCopyPerviousData', () => {
412397
test('returned data should be equal to optionsManager.initialState in onLoad event', () => {
413398
expect.assertions(2);
@@ -428,6 +413,19 @@ describe('Api.prototype.getCopyPerviousData', () => {
428413
obj.updateStateRef({ selectedTabID: 'tab1', openTabIDs: ['tab1', 'tab2'] }, () => { });
429414
obj.trigger('onLoad', obj.userProxy);
430415
});
416+
test('In the onLoad event, return data is equal to getInitialState() and getCopyData()', () => {
417+
expect.assertions(3);
418+
const _state = { selectedTabID: 'tab1', openTabIDs: ['tab1', 'tab2'] };
419+
obj.setOption('onLoad', function () {
420+
const perviousData = this.getCopyPerviousData();
421+
const data = this.getCopyData();
422+
expect(perviousData).toEqual(_state);
423+
expect(perviousData).toEqual(data);
424+
expect(perviousData !== null).toBe(true);
425+
});
426+
obj.updateStateRef(_state, () => { });
427+
obj.trigger('onLoad', obj.userProxy);
428+
});
431429
});
432430
describe('Api.prototype.setTab : ', () => {
433431
test('it should call optionsManager.validateObjectiveTabData and validatePanelComponent internally', () => {

src/utils/api/optionManager/optionManager.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ describe('OptionManager.prototype.setOption : ', () => {
142142
const tabs = obj.getOption('tabs');
143143
obj.setOption('tabs', [{ id: '3', title: 'c' }]);
144144
const newTabs = obj.getOption('tabs');
145-
expect(tabs).toBe(newTabs);
145+
expect(tabs).not.toBe(newTabs);
146+
expect(tabs).toEqual(newTabs);
146147
});
147148
it('it can not set selectedTabID option', () => {
148149
const selectedTabID = obj.getOption('selectedTabID');

0 commit comments

Comments
 (0)