I need to have the following test suite code in jasmine to make it works
beforeAll(function(done) {
window.addEventListener('WebComponentsReady', function(e) {
console.log("WebComponents is ready");
stockticker = document.createElement('stock-ticker');
stockticker.setAttribute('symbols', '["GOOG", "GOOGL"]');
stockticker.setAttribute('id', id_name);
document.body.appendChild(stockticker);
// get element now and use it throughout test case
//to_check = document.getElementById(id_name);
to_check = document.getElementById(id_name);
done();
});
});
polymer.create('stock-ticker', function(el) { ... }) - its callback function is not getting called. Thus I have to rely on pure javascript to write testing code as seen above.
I have to wrap my testing code inside WebComponentsReady event. I then can safely create a new element thus each test case will be able to call component's member functions.
PS. This info might be needed as my component spans into 2 files: .js and .html. Thus when include into karma.conf.js, I need to write config file as seen in this comment.
I need to have the following test suite code in jasmine to make it works
polymer.create('stock-ticker', function(el) { ... })
- its callback function is not getting called. Thus I have to rely on pure javascript to write testing code as seen above.I have to wrap my testing code inside
WebComponentsReady
event. I then can safely create a new element thus each test case will be able to call component's member functions.PS. This info might be needed as my component spans into 2 files:
.js
and.html
. Thus when include intokarma.conf.js
, I need to write config file as seen in this comment.