Esempio n. 1
0
 it('should fire when `activeIndex` is changed', function () {
     var wizard = new Wizard({ steps: steps });
     wizard.appendTo(container);
     var handler = jasmine.createSpy();
     wizard.on('enter', handler);
     wizard.set('activeIndex', 2);
     expect(handler).toHaveBeenCalled();
 });
Esempio n. 2
0
 it('should not fire when `steps` is set but not changed', function () {
     var wizard = new Wizard({ steps: steps });
     wizard.appendTo(container);
     var handler = jasmine.createSpy();
     wizard.on('enter', handler);
     wizard.set('steps', steps);
     expect(handler).not.toHaveBeenCalled();
 });
Esempio n. 3
0
 it('should add a `ui-wizard-panel-hidden` class on all related `panel` for non-active nodes when `activeIndex` is changed', function () {
     container.innerHTML = '<div id="a"></div><div id="b"></div>';
     var wizard = new Wizard({ steps: steps });
     wizard.appendTo(container);
     wizard.set('activeIndex', 1);
     expect(document.getElementById('a').className).toMatch(/ui-wizard-panel-hidden/);
     expect(document.getElementById('b').className).not.toMatch(/ui-wizard-panel-hidden/);
 });
Esempio n. 4
0
 it('should rerender nodes when `finishText` is changed', function () {
     var wizard = new Wizard({ steps: steps });
     wizard.appendTo(container);
     wizard.set('finishText', '4');
     var nodes = container.getElementsByTagName('li');
     expect(nodes.length).toBe(4);
     expect(nodes[3].innerText).toBe('4');
 });
Esempio n. 5
0
 it('should change the active node when `activeIndex` is changed', function () {
     var wizard = new Wizard({ steps: steps });
     wizard.appendTo(container);
     wizard.set('activeIndex', 2);
     var nodes = container.getElementsByTagName('li');
     expect(nodes[0].className).not.toMatch(/ui-wizard-node-active/);
     expect(nodes[2].className).toMatch(/ui-wizard-node-active/);
 });
Esempio n. 6
0
 it('should rerender nodes when `steps` is changed', function () {
     var wizard = new Wizard({ steps: steps });
     wizard.appendTo(container);
     wizard.set('steps', steps.slice(0, 2));
     var nodes = container.getElementsByTagName('li');
     expect(nodes.length).toBe(2);
     expect(nodes[0].innerText).toBe('1');
     expect(nodes[1].innerText).toBe('2');
 });
Esempio n. 7
0
 it('should reset `activeIndex` to 0 if `steps` is changed and no new `activeIndex` is given', function () {
     var wizard = new Wizard({ steps: steps, activeIndex: 2 });
     wizard.set('steps', steps.slice(0, 2));
     expect(wizard.get('activeIndex')).toBe(0);
 })