mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
Polish the Scenario Runner UI to include: - a scroll pane that steps appear in since the list can be very long - Collapse successful tests - Show the line where the DSL statements were when there's an error (Chrome, Firefox) Also: - Remove lots angular.bind calls to reduce the amount of stack space used. - Use setTimeout(...,0) to schedule the next future to let the browser breathe and have it repaint the steps. Also prevents overflowing the stack when an it() creates many futures. - Run afterEach() handlers even if the it() block fails. - Make navigateTo() take a function as the second argument so you can compute a URL in the future. - Add wait() DSL statement to allow interactive debugging of tests. - Allow custom jQuery selectors with element(...).query(fn) DSL statement. Known Issues: - All afterEach() handlers run even if a beforeEach() handler fails. Only after handlers for the same level as the failure and above should run.
55 lines
2.2 KiB
JavaScript
55 lines
2.2 KiB
JavaScript
describe('widgets', function() {
|
|
it('should verify that basic widgets work', function(){
|
|
navigateTo('widgets.html');
|
|
|
|
using('#text-basic-box').input('text.basic').enter('Carlos');
|
|
expect(binding('text.basic')).toEqual('Carlos');
|
|
input('text.basic').enter('Carlos Santana');
|
|
expect(binding('text.basic')).not().toEqual('Carlos Boozer');
|
|
|
|
input('text.password').enter('secret');
|
|
expect(binding('text.password')).toEqual('secret');
|
|
|
|
expect(binding('text.hidden')).toEqual('hiddenValue');
|
|
|
|
expect(binding('gender')).toEqual('male');
|
|
input('gender').select('female');
|
|
expect(using('#gender-box').binding('gender')).toEqual('female');
|
|
|
|
expect(repeater('#repeater-row ul li').count()).toEqual(2);
|
|
expect(repeater('#repeater-row ul li').row(1)).toEqual(['adam']);
|
|
expect(repeater('#repeater-row ul li').column('name')).toEqual(['misko', 'adam']);
|
|
|
|
select('select').option('B');
|
|
expect(binding('select')).toEqual('B');
|
|
|
|
select('multiselect').options('A', 'C');
|
|
expect(binding('multiselect').fromJson()).toEqual(['A', 'C']);
|
|
|
|
expect(binding('button').fromJson()).toEqual({'count': 0});
|
|
element('form a').click();
|
|
expect(binding('button').fromJson()).toEqual({'count': 1});
|
|
element('input[value="submit"]').click();
|
|
expect(binding('button').fromJson()).toEqual({'count': 2});
|
|
element('input[value="button"]').click();
|
|
expect(binding('button').fromJson()).toEqual({'count': 3});
|
|
element('input[type="image"]').click();
|
|
expect(binding('button').fromJson()).toEqual({'count': 4});
|
|
|
|
/**
|
|
* Custom value parser for futures.
|
|
*/
|
|
function checkboxParser(value) {
|
|
return angular.fromJson(value.substring(value.indexOf('=')+1));
|
|
}
|
|
|
|
input('checkbox.tea').check();
|
|
expect(binding('checkbox').parsedWith(checkboxParser)).toEqual({coffee: false, tea: false});
|
|
input('checkbox.coffee').check();
|
|
expect(binding('checkbox').parsedWith(checkboxParser)).toEqual({coffee: true, tea: false});
|
|
input('checkbox.tea').check();
|
|
input('checkbox.tea').check();
|
|
input('checkbox.tea').check();
|
|
expect(binding('checkbox').parsedWith(checkboxParser)).toEqual({coffee: true, tea: true});
|
|
});
|
|
});
|