work around Svelte hydration failures

This commit is contained in:
Rich Harris
2018-01-20 12:53:06 -05:00
parent d77722c042
commit faeddd8add
2 changed files with 5 additions and 3 deletions

View File

@@ -13,6 +13,8 @@
<p><strong>Try editing this file (routes/index.html) to test hot module reloading.</strong></p> <p><strong>Try editing this file (routes/index.html) to test hot module reloading.</strong></p>
</Layout> </Layout>
<div class='hydrate-test'></div>
<style> <style>
h1, figure, p { h1, figure, p {
text-align: center; text-align: center;

View File

@@ -317,13 +317,13 @@ function run(env) {
it('hydrates initial route', () => { it('hydrates initial route', () => {
return nightmare.goto(base) return nightmare.goto(base)
.wait('h1') .wait('.hydrate-test')
.evaluate(() => { .evaluate(() => {
window.h1 = document.querySelector('h1'); window.el = document.querySelector('.hydrate-test');
}) })
.init().wait(100) .init().wait(100)
.evaluate(() => { .evaluate(() => {
return document.querySelector('h1') === window.h1; return document.querySelector('.hydrate-test') === window.el;
}) })
.then(matches => { .then(matches => {
assert.ok(matches); assert.ok(matches);