make fixture await render if contents are attached

This commit is contained in:
Elliott Marquez 2019-08-21 18:55:22 -07:00
parent 21a7d5d886
commit 3fe99dc4bd
2 changed files with 9 additions and 1 deletions

View File

@ -40,6 +40,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- mwc-floating-label-directive - mwc-floating-label-directive
- mwc-top-app-bar-fixed - mwc-top-app-bar-fixed
- mwc-top-app-bar-short - mwc-top-app-bar-short
- Testing Infra:
- Tests now in TS
- Tests now all pass
-
## [0.6.0] - 2019-06-05 ## [0.6.0] - 2019-06-05
- Upgrade lerna to 3.x - Upgrade lerna to 3.x

View File

@ -89,13 +89,17 @@ interface FixtureOptions {
} }
export const fixture = export const fixture =
(template: TemplateResult, options?: Partial<FixtureOptions>) => { async (template: TemplateResult, options?: Partial<FixtureOptions>) => {
const opts: FixtureOptions = {...defaultOpts, ...options}; const opts: FixtureOptions = {...defaultOpts, ...options};
const tf = opts.document.createElement('test-fixture') as TestFixture; const tf = opts.document.createElement('test-fixture') as TestFixture;
tf.shouldAttachContents = opts.shouldAttachContents; tf.shouldAttachContents = opts.shouldAttachContents;
tf.template = template; tf.template = template;
opts.document.body.appendChild(tf); opts.document.body.appendChild(tf);
if (opts.shouldAttachContents) {
await tf.updateComplete;
}
return tf; return tf;
}; };