|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +/** |
| 4 | + * This scenario checks if the usage section for selected directives is rendered correctly |
| 5 | + */ |
| 6 | + |
| 7 | +describe('usage section', function() { |
| 8 | + |
| 9 | + describe('should list the directive name', function() { |
| 10 | + |
| 11 | + it('when directive name is a parameter with a value', function() { |
| 12 | + browser.get('build/docs/index.html#!/api/ng/directive/ngInclude'); |
| 13 | + |
| 14 | + // Ensure that ngInclude appears as an argument |
| 15 | + var args = element(by.className('input-arguments')); |
| 16 | + |
| 17 | + var paramNames = args.all(by.css('tr td:nth-child(1)')); |
| 18 | + |
| 19 | + expect(paramNames.getText()).toContain('ngInclude | src'); |
| 20 | + |
| 21 | + var usage = element(by.className('usage')); |
| 22 | + |
| 23 | + var asElement = usage.element(by.cssContainingText('li', 'as element')); |
| 24 | + var asAttribute = usage.element(by.cssContainingText('li', 'as attribute')); |
| 25 | + var asCssClass = usage.element(by.cssContainingText('li', 'as CSS class')); |
| 26 | + |
| 27 | + expect(asElement.element(by.cssContainingText('span.tag', 'ng-include')).isPresent()).toBe(true); |
| 28 | + expect(asAttribute.element(by.cssContainingText('span.atn', 'ng-include')).isPresent()).toBe(true); |
| 29 | + expect(asCssClass.element(by.cssContainingText('span.atv', 'ng-include')).isPresent()).toBe(true); |
| 30 | + }); |
| 31 | + |
| 32 | + |
| 33 | + it('when directive name is a void parameter', function() { |
| 34 | + browser.get('build/docs/index.html#!/api/ngRoute/directive/ngView'); |
| 35 | + |
| 36 | + // Ensure that ngView does not appear as an argument |
| 37 | + var args = element(by.className('input-arguments')); |
| 38 | + |
| 39 | + var paramNames = args.all(by.css('tr td:nth-child(1)')); |
| 40 | + |
| 41 | + expect(paramNames.getText()).not.toContain('ngView'); |
| 42 | + |
| 43 | + var usage = element(by.className('usage')); |
| 44 | + |
| 45 | + var asElement = usage.element(by.cssContainingText('li', 'as element')); |
| 46 | + var asAttribute = usage.element(by.cssContainingText('li', 'as attribute')); |
| 47 | + var asCssClass = usage.element(by.cssContainingText('li', 'as CSS class')); |
| 48 | + |
| 49 | + expect(asElement.element(by.cssContainingText('span.tag', 'ng-view')).isPresent()).toBe(true); |
| 50 | + expect(asAttribute.element(by.cssContainingText('span.atn', 'ng-view')).isPresent()).toBe(true); |
| 51 | + expect(asCssClass.element(by.cssContainingText('span.atv', 'ng-view')).isPresent()).toBe(true); |
| 52 | + }); |
| 53 | + |
| 54 | + }); |
| 55 | +}); |
0 commit comments