-
Notifications
You must be signed in to change notification settings - Fork 429
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
Add a "reload" method to the frame element #206
Conversation
src/elements/frame_element.ts
Outdated
const srcAttribute = this.src; | ||
this.src = null; | ||
this.src = srcAttribute; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've using ES6 here, so let's do:
const srcAttribute = this.src; | |
this.src = null; | |
this.src = srcAttribute; | |
const { src } = this | |
this.src = null | |
this.src = src |
|
||
const frameContent = "#loading-eager turbo-frame#frame h2" | ||
this.assert.ok(await this.hasSelector(frameContent)) | ||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.assert.ok(await this.hasSelector(frameContent)) | ||
// @ts-ignore | ||
await this.remote.execute(() => document.querySelector("#loading-eager turbo-frame")?.reload()) | ||
this.assert.ok(await this.hasSelector(frameContent)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we're using tabs for some of these lines, can you switch to just spaces?
await this.remote.execute(() => document.querySelector("#loading-eager turbo-frame")?.reload()) | ||
this.assert.ok(await this.hasSelector(frameContent)) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our style before didn't add an extra line, so we should cut this one too.
Can the |
I am not sure how to achieve that. The target of |
@coorasse may i suggest an additional improvement to this PR would for the reload() function to accept an optional parameter to specify the URL to set src as. This would be useful if you don't already have one, and want to set it as a the same URL, or if for some reason the URL changes and you want it pointing somewhere else. |
As proposed in #202, this PR adds a
.reload()
method on the frame that allows to refresh its content.Open points:
reload()
will simply have no effect. To me this is simple and stupid, so it should be fine.