dom-if
Element
that is dynamically added to the DOM with dom-if
, use parentElement.querySelector('#id')
instead of parentElement.$['id']
.flush
after appending your Component to the document.body
:async
behaviordocument
. This means that you should clean up the document
just before each test finishes, ensuring that you leave the document in the same state it was before conducting this very test. This may imply the following:Element
to the document.body
, remember to document.body.removeChild
this element.setTimeout
: Tests are (generally) performed really fast, completing and quitting well before a delayed function is called. Of course, you can wait for the delayed function to be called in your test code, but remember that tests are supposed to be run frequently, and the additional delay could accummulate to a considerable waste of time. Therefore, I would generally warn against using setTimeout
at all.@polymer/app-route
, which interacts with the URL. This can be really tricky, as the URL of the testing document
is probably some random HTML file. I still have not yet found a nice way to test routing behaviors.<app-location>
?karma_web_test_suite
?) will execute tests in some '/context.html'
(this will be your window.location.pathname
). This will make testing <app-location>
and <app-route>
painful.PaperListboxElement.select
is not a function in Jasmine?!appendChild
-ing to document.body
-- I suppose using fixture will make this problem go away. Methods tried and didn't work for selecting an item in a <paper-listbox>
programatically: