|
| 1 | +describe('Schema Form custom validators', function() { |
| 2 | + it('should have a form with content', function() { |
| 3 | + browser.get('http://localhost:8080/examples/custom-validators.html'); |
| 4 | + |
| 5 | + expect(element(by.css('form')).getInnerHtml()).not.toEqual(''); |
| 6 | + }); |
| 7 | + |
| 8 | + describe('#name', function() { |
| 9 | + it('should not complain if it gets a normal name', function() { |
| 10 | + browser.get('http://localhost:8080/examples/custom-validators.html'); |
| 11 | + var input = element.all(by.css('form input')).first(); |
| 12 | + input.sendKeys('Joe Schmoe'); |
| 13 | + |
| 14 | + expect(input.getAttribute('value')).toEqual('Joe Schmoe'); |
| 15 | + expect(input.evaluate('ngModel.$valid')).toEqual(true); |
| 16 | + |
| 17 | + }); |
| 18 | + |
| 19 | + it('should complain if it gets a "Bob" as a name', function() { |
| 20 | + browser.get('http://localhost:8080/examples/custom-validators.html'); |
| 21 | + var input = element.all(by.css('form input')).first(); |
| 22 | + input.sendKeys('Bob'); |
| 23 | + |
| 24 | + expect(input.getAttribute('value')).toEqual('Bob'); |
| 25 | + expect(input.evaluate('ngModel.$valid')).toEqual(false); |
| 26 | + }); |
| 27 | + }); |
| 28 | + |
| 29 | + describe('#email', function() { |
| 30 | + it('should not complain if it gets a normal email', function() { |
| 31 | + browser.get('http://localhost:8080/examples/custom-validators.html'); |
| 32 | + var input = element.all(by.css('form input')).get(1); |
| 33 | + input.sendKeys('[email protected]'); |
| 34 | + |
| 35 | + expect(input.getAttribute('value')).toEqual('[email protected]'); |
| 36 | + expect(input.evaluate('ngModel.$valid')).toEqual(true); |
| 37 | + |
| 38 | + }); |
| 39 | + |
| 40 | + it('should complain if it gets a my email', function() { |
| 41 | + browser.get('http://localhost:8080/examples/custom-validators.html'); |
| 42 | + var input = element.all(by.css('form input')).get(1); |
| 43 | + input.sendKeys('[email protected]'); |
| 44 | + |
| 45 | + expect(input.getAttribute('value')).toEqual('[email protected]'); |
| 46 | + expect(input.evaluate('ngModel.$valid')).toEqual(false); |
| 47 | + }); |
| 48 | + }); |
| 49 | + |
| 50 | + describe('#comment', function() { |
| 51 | + it('should not complain if it gets a normal email', function() { |
| 52 | + browser.get('http://localhost:8080/examples/custom-validators.html'); |
| 53 | + var input = element.all(by.css('form input')).get(1); |
| 54 | + input.sendKeys('[email protected]'); |
| 55 | + |
| 56 | + expect(input.getAttribute('value')).toEqual('[email protected]'); |
| 57 | + expect(input.evaluate('ngModel.$valid')).toEqual(true); |
| 58 | + |
| 59 | + }); |
| 60 | + |
| 61 | + it('should complain if it gets a my email', function() { |
| 62 | + browser.get('http://localhost:8080/examples/custom-validators.html'); |
| 63 | + var input = element.all(by.css('form input')).get(1); |
| 64 | + input.sendKeys('[email protected]'); |
| 65 | + |
| 66 | + expect(input.getAttribute('value')).toEqual('[email protected]'); |
| 67 | + expect(input.evaluate('ngModel.$valid')).toEqual(false); |
| 68 | + }); |
| 69 | + }); |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +}); |
0 commit comments