Files
edx-platform/xmodule/js/spec/split_test/staff_view_spec.js
M Umar Khan a91df0c40f refactor: move xmodule folder to root
- Moving xmodule folder to root as we're dissolving sub-projects of common folder in edx-platform
    - More info: https://openedx.atlassian.net/browse/BOM-2579
- -e common/lib/xmodule has been removed from the requirements as xmodule has itself become the part of edx-platform and not being installed through requirements
- The test files common/lib/xmodule/test_files/ have been removed as they are not being used anymore
2022-06-20 14:33:45 +05:00

36 lines
1.3 KiB
JavaScript

describe('Tests for split_test staff view switching', function() {
var ab_module;
var $elem;
beforeEach(function() {
loadFixtures('split_test_staff.html');
$elem = $('#split-test');
window.XBlock = jasmine.createSpyObj('XBlock', ['initializeBlocks']);
ab_module = ABTestSelector(null, $elem);
});
afterEach(function() {
delete window.XBlock;
});
it('test that we have only one visible condition', function() {
var containers = $elem.find('.split-test-child-container').length;
var conditions_shown = $elem.find('.split-test-child-container .condition-text').length;
expect(containers).toEqual(1);
expect(conditions_shown).toEqual(1);
expect(XBlock.initializeBlocks).toHaveBeenCalled();
});
it('test that the right child is visible when selected', function() {
var groups = ['0', '1', '2'];
for (var i = 0; i < groups.length; i++) {
var to_select = groups[i];
$elem.find('.split-test-select').val(to_select).change();
var child_text = $elem.find('.split-test-child-container .condition-text').text();
expect(child_text).toContain(to_select);
expect(XBlock.initializeBlocks).toHaveBeenCalled();
}
});
});