Aurelia Custom Element

Unit testing question: When I test a component according to the example of aurelia.io,

...
component = StageComponent
  .withResources('components/comp/comp')
  .inView('<comp data.bind="info"></comp>')
  .boundTo({info: data});
...

I can query the document and check the attribute values ​​of the DOM nodes.

const nameElement = document.getElementById('elem-id');

When I try to validate an element,

...
component = StageComponent
  .withResources('components/elemy/elemy')
  .inView('<compose view.bind="components/elemy/elemy.html" '+
        'view-model="components/elemy/elemy" model.bind="info">       </compose>')
  .boundTo({info: data});
...

I can see them in the browser that launches Karma during testing, and if I check, I see that the information was correctly passed to the user element. But document requests return null:

const nameElement = document.getElementById('elem-id');

Am I missing something obvious? The reason I want to test with compose is because I am using a custom element. It does not have @bindable, only activates (model)

+1
source share

Source: https://habr.com/ru/post/1667041/


All Articles