Sto cercando di scrivere un test di integrazione dei componenti, alla this blog post, ma la mia componente ha un link-to
ad un percorso dinamico e la proprietà href
non viene riempita in Ecco una versione semplificata di ciò che sto cercando di fare.Ember Integration Component Test: `link-to` href vuoto
modello di mia componente:
{{#link-to "myModel" model}}
E qui è la parte rilevante del mio test:
this.set('model', {
id: 'myId',
name: 'My Name'
});
this.render(hbs`
{{my-component model=model}}
`);
assert.equal(this.$('a').attr('href'), '/myModel/myId'); // fails
Il link-to
è resa, ma senza un attributo href
. Se accedo il codice HTML nel test, sembra che:
<a id="ember283" class="ember-view">My Name</a>
C'è qualcosa che devo fare per il mio "modello" per ottenere il link-to
di avere un href? Ho provato a esaminare i test per link-to
in inglese e ho trovato this part of the tests, che è fondamentalmente quello che sto facendo: fornire un POJO con il set di chiavi id
. Qualche idea?
Edit:
DEBUG: -------------------------------
DEBUG: Ember : 1.13.8
DEBUG: Ember Data : 1.13.10
DEBUG: jQuery : 1.11.3
DEBUG: -------------------------------
E 'test di integrazione o di unit test? –
@Daniel: test di integrazione –