lundi 23 mars 2015

Ember.js: find DOM element by binding / model

Angular's Protractor lets you find an element by various "angular properties", such as binding, model, repeater, etc.



<span>{{person.name}}</span>
<span ng-bind="person.email"></span>
<input type="text" ng-model="person.name"/>


then



// Find element with {{scopeVar}} syntax.
element(by.binding('person.name')).getText().then(function(name) {
expect(name).toBe('Foo');
});

// Find element with ng-bind="scopeVar" syntax.
expect(element(by.binding('person.email')).getText()).toBe('foo@bar.com');

// Find by model.
var input = element(by.model('person.name'));
input.sendKeys('123');
expect(input.getAttribute('value')).toBe('Foo123');


This is done by regular javascript in the clientside as seen here.


Is there something similar for Ember.js?


I'm talking about the element(by.someLocator(...)) API.





Aucun commentaire:

Enregistrer un commentaire