-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fire 'turbo:frame-render' event after turbo frame renders the view (#327
) * Fire 'turbo:after-fetch-render' event after turbo frame renders the view * fixup! Fire 'turbo:after-fetch-render' event after turbo frame renders the view * Change 'turbo:after-fetch-render' event to 'turbo:frame-render' * Implement notifyApplicationAfterFrameRender in order to dispatch the 'turbo:frame-render' event * Dispatch `turbo:frame-load` on turbo-frame Closes #54 Closes hotwired/turbo-rails#56 Dispatch `turbo:frame-load` lifecycle event when `<turbo-frame>` element is navigated and finishes loading. The events bubble up, with the `<turbo-frame>` element as the target. Originally, this pull request involved numerous events, but in the spirit of experimentation, we'll start with the one and see if others are necessary. * fixup! Dispatch `turbo:frame-load` on turbo-frame Co-authored-by: John Kapantzakis <kapantzak@192.168.2.2> Co-authored-by: David Heinemeier Hansson <david@loudthinking.com> Co-authored-by: Sean Doyle <sean.p.doyle24@gmail.com>
- Loading branch information
1 parent
e7a0b91
commit 84b0a89
Showing
10 changed files
with
97 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Turbo</title> | ||
<script src="/dist/turbo.es2017-umd.js" data-turbo-track="reload"></script> | ||
<script src="/src/tests/fixtures/test.js"></script> | ||
</head> | ||
<body> | ||
<div id="container"> | ||
<a id="outside" href="/src/tests/fixtures/frame_navigation.html" data-turbo-frame="frame">Outside Frame</a> | ||
|
||
<turbo-frame id="frame"> | ||
<h2>Frame Navigation</h2> | ||
|
||
<a id="inside" href="/src/tests/fixtures/frame_navigation.html">Inside Frame</a> | ||
<a id="top" href="/src/tests/fixtures/frame_navigation.html" data-turbo-frame="_top">Top</a> | ||
</turbo-frame> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<turbo-frame id="part"> | ||
<h2>Frames: #frame-part</h2> | ||
</turbo-frame> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { TurboDriveTestCase } from "../helpers/turbo_drive_test_case" | ||
|
||
export class FrameNavigationTests extends TurboDriveTestCase { | ||
async setup() { | ||
await this.goToLocation("/src/tests/fixtures/frame_navigation.html") | ||
} | ||
|
||
async "test frame navigation with descendant link"() { | ||
await this.clickSelector("#inside") | ||
|
||
await this.nextEventOnTarget("frame", "turbo:frame-load") | ||
} | ||
|
||
async "test frame navigation with exterior link"() { | ||
await this.clickSelector("#outside") | ||
|
||
await this.nextEventOnTarget("frame", "turbo:frame-load") | ||
} | ||
} | ||
|
||
FrameNavigationTests.registerSuite() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters