| 
									
										
										
										
											2016-10-20 10:56:17 -07:00
										 |  |  | 'use strict'; // necessary for es6 output in node
 | 
					
						
							| 
									
										
										
										
											2016-10-06 23:25:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | import { browser, element, by } from 'protractor'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-20 13:17:16 -08:00
										 |  |  | // Not yet complete
 | 
					
						
							|  |  |  | describe('Template Syntax', function () { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   beforeAll(function () { | 
					
						
							|  |  |  |     browser.get(''); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should be able to use interpolation with a hero', function () { | 
					
						
							| 
									
										
										
										
											2016-05-30 11:05:09 -07:00
										 |  |  |     let heroInterEle = element.all(by.css('h2+p')).get(0); | 
					
						
							| 
									
										
										
										
											2015-12-20 13:17:16 -08:00
										 |  |  |     expect(heroInterEle.getText()).toEqual('My current hero is Hercules'); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should be able to use interpolation with a calculation', function () { | 
					
						
							| 
									
										
										
										
											2016-06-08 01:06:25 +02:00
										 |  |  |     let theSumEles = element.all(by.cssContainingText('h3~p', 'The sum of')); | 
					
						
							| 
									
										
										
										
											2015-12-20 13:17:16 -08:00
										 |  |  |     expect(theSumEles.count()).toBe(2); | 
					
						
							|  |  |  |     expect(theSumEles.get(0).getText()).toEqual('The sum of 1 + 1 is 2'); | 
					
						
							|  |  |  |     expect(theSumEles.get(1).getText()).toEqual('The sum of 1 + 1 is not 4'); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should be able to use class binding syntax', function () { | 
					
						
							| 
									
										
										
										
											2016-06-08 01:06:25 +02:00
										 |  |  |     let specialEle = element(by.cssContainingText('div', 'Special')); | 
					
						
							| 
									
										
										
										
											2015-12-20 13:17:16 -08:00
										 |  |  |     expect(specialEle.getAttribute('class')).toMatch('special'); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should be able to use style binding syntax', function () { | 
					
						
							| 
									
										
										
										
											2016-05-30 11:05:09 -07:00
										 |  |  |     let specialButtonEle = element(by.cssContainingText('div.special~button', 'button')); | 
					
						
							| 
									
										
										
										
											2015-12-20 13:17:16 -08:00
										 |  |  |     expect(specialButtonEle.getAttribute('style')).toMatch('color: red'); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2016-10-20 10:56:17 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-10 20:01:36 -08:00
										 |  |  |   it('should two-way bind to sizer', async () => { | 
					
						
							|  |  |  |     let div = element(by.css('div#two-way-1')); | 
					
						
							|  |  |  |     let incButton = div.element(by.buttonText('+')); | 
					
						
							|  |  |  |     let input = div.element(by.css('input')); | 
					
						
							|  |  |  |     let initSize = await input.getAttribute('value'); | 
					
						
							|  |  |  |     incButton.click(); | 
					
						
							|  |  |  |     expect(input.getAttribute('value')).toEqual((+initSize + 1).toString()); | 
					
						
							| 
									
										
										
										
											2016-10-20 10:56:17 -07:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2015-12-20 13:17:16 -08:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2016-11-10 20:01:36 -08:00
										 |  |  | 
 |