web component tester - Calling unit/functional test assertions after change events in Polymer -
i've been writing functional tests in mocha, changing items , checking if changes propagated correctly. currently, i'm using window timeouts give polymer time update elements, feels hack. developer guide outlines few different observation hooks, i'm not sure 1 should call.
the 1 sounds closest a recommendation attach async call propertychanged event. however, many items use propertychanged, attaching async task propertychanged event reliably call async task after element's methods attached original propertychanged have been called?
bonus points information on whether given solution forward compatible polymer 1.0 (or .8/.9).
i looking in wrong place, right place async portion of polymer's testing how-to. right function use flush(callback)
, "trigger flush of pending events , observations, ensuring notification callbacks dispatched after have been processed."
their documentation globs tests together, prefer individual elements each test-suite , each test. helpful when debugging functional tests changes preserved , it's easier setup break points:
before(function(done){ nonmatchingel.search = ""; flush(done); }); test('updates "pre" property', function() { assert.equal(nonmatchingel.pre, 'prematch-hello-postmatchhello'); }); //test 2 ...
Comments
Post a Comment