Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix window bindings to store #3835

Merged

Conversation

tanhauhau
Copy link
Member

@tanhauhau tanhauhau commented Nov 1, 2019

Fix #3832

  • added global.window = window to be able to access the window object from global to pass the test.

on a side note, i see a lot of test got skip=true due to jsdom, has the jsdom bug fixed?

@@ -127,7 +127,11 @@ export default class WindowWrapper extends Wrapper {

component.partly_hoisted.push(b`
function ${id}() {
${props.map(prop => b`$$invalidate('${prop.name}', ${prop.name} = @_window.${prop.value});`)}
${props.map(prop =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, it would be good to use the Component#invalidate() helper to generate this. It has logic built into it to .set() on stores and $$invalidate() for non-stores. Same below with the online binding.

@@ -0,0 +1,133 @@
import {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this js test testing for anything in particular that the other runtime test doesn't cover? In general, we like to avoid having tests for particular js output if possible, because they need to be updated when there are changes to the generated code, and runtime tests continue to just work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to take snapshot of the generated output?
I thought it would be great to have both snapshot test and behaviour test?

@Conduitry Conduitry merged commit 0c8cb44 into sveltejs:master Nov 3, 2019
@tanhauhau tanhauhau deleted the tanhauhau/fix-window-bind-to-store branch November 3, 2019 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Window bindings to stores don't work
2 participants