mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-11 19:04:30 +00:00
use devalue instead of serialize-javascript - fixes #112
This commit is contained in:
17
test/app/routes/preload-values/custom-class.html
Normal file
17
test/app/routes/preload-values/custom-class.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<h1>{{foo.bar()}}</h1>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
preload() {
|
||||
class Foo {
|
||||
bar() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
foo: new Foo()
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
11
test/app/routes/preload-values/set.html
Normal file
11
test/app/routes/preload-values/set.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<h1>{{set.has('x')}}</h1>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
preload() {
|
||||
return {
|
||||
set: new Set(['x'])
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -487,6 +487,30 @@ function run(env) {
|
||||
assert.equal(title, `I'm afraid I just blue myself`);
|
||||
});
|
||||
});
|
||||
|
||||
it('serializes Set objects returned from preload', () => {
|
||||
return nightmare.goto(`${base}/preload-values/set`)
|
||||
.page.title()
|
||||
.then(title => {
|
||||
assert.equal(title, 'true');
|
||||
return nightmare.init().page.title();
|
||||
})
|
||||
.then(title => {
|
||||
assert.equal(title, 'true');
|
||||
});
|
||||
});
|
||||
|
||||
it('bails on custom classes returned from preload', () => {
|
||||
return nightmare.goto(`${base}/preload-values/custom-class`)
|
||||
.page.title()
|
||||
.then(title => {
|
||||
assert.equal(title, '42');
|
||||
return nightmare.init().page.title();
|
||||
})
|
||||
.then(title => {
|
||||
assert.equal(title, '42');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('headers', () => {
|
||||
|
||||
Reference in New Issue
Block a user