Skip to content

Commit 9803ff5

Browse files
committed
added specs for navigation fix and updated assets
1 parent 417824d commit 9803ff5

File tree

4 files changed

+62
-9
lines changed

4 files changed

+62
-9
lines changed

spec/usage/components/transition_spec.rb

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def response
1414
transition path: :page1_path do
1515
button text: "Page 1"
1616
end
17-
transition path: :page2_path do
17+
transition path: :page2_path, params: { some_other_param: "bar" } do
1818
button text: "Page 2"
1919
end
2020
end
@@ -37,6 +37,7 @@ def response
3737
div id: "my-div-on-page-1" do
3838
heading size: 2, text: "This is Page 1"
3939
plain "#{DateTime.now.strftime('%Q')}"
40+
plain "#{context[:params][:some_param]}"
4041
end
4142
}
4243
end
@@ -53,6 +54,7 @@ def response
5354
end
5455
transition path: :page1_path do
5556
button text: "Back to Page 1"
57+
plain "#{context[:params][:some_other_param]}"
5658
end
5759
}
5860
end
@@ -157,6 +159,53 @@ def page2
157159
expect(page).to have_selector("body.not-reloaded")
158160
end
159161

162+
it "Example 3 - Perform transition from one page to another without page reload when using page history buttons" do
163+
164+
visit "/my_example_app/page1?some_param=foo"
165+
166+
expect(page).to have_content("My Example App Layout")
167+
expect(page).to have_button("Page 1")
168+
expect(page).to have_button("Page 2")
169+
170+
expect(page).to have_content("This is Page 1")
171+
expect(page).to have_content("foo")
172+
expect(page).not_to have_content("This is Page 2")
173+
174+
element = page.find("#my-div-on-page-1")
175+
first_content_on_page_1 = element.text
176+
177+
page.evaluate_script('document.body.classList.add("not-reloaded")')
178+
expect(page).to have_selector("body.not-reloaded")
179+
180+
click_button("Page 2")
181+
182+
expect(page).to have_content("My Example App Layout")
183+
expect(page).not_to have_content("This is Page 1")
184+
expect(page).not_to have_content("foo")
185+
expect(page).to have_content("This is Page 2")
186+
expect(page).to have_content("bar")
187+
expect(page).to have_selector("body.not-reloaded")
188+
189+
page.go_back
190+
191+
expect(page).to have_content("My Example App Layout")
192+
expect(page).to have_content("This is Page 1")
193+
expect(page).to have_content("foo")
194+
expect(page).not_to have_content("This is Page 2")
195+
expect(page).not_to have_content("bar")
196+
expect(page).to have_selector("body.not-reloaded")
197+
expect(page).to have_no_content(first_content_on_page_1)
198+
199+
page.go_forward
200+
201+
expect(page).to have_content("My Example App Layout")
202+
expect(page).not_to have_content("This is Page 1")
203+
expect(page).not_to have_content("foo")
204+
expect(page).to have_content("This is Page 2")
205+
expect(page).to have_content("bar")
206+
expect(page).to have_selector("body.not-reloaded")
207+
end
208+
160209
# supposed to work, but doesn't. Suspect Vue is the culprint here
161210
# it "Example 2 - Perform transition from one page to another by providing route as string (not recommended)" do
162211
#

vendor/assets/javascripts/dist/manifest.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@
22
"entrypoints": {
33
"matestack-ui-core": {
44
"css": [
5-
"/dist/matestack-ui-core.min.css"
5+
"/dist/matestack-ui-core.css"
66
],
77
"js": [
8-
"/dist/matestack-ui-core.min.js"
8+
"/dist/matestack-ui-core.js"
9+
],
10+
"css.map": [
11+
"/dist/matestack-ui-core.css.map"
912
],
1013
"js.map": [
11-
"/dist/matestack-ui-core.min.js.map"
14+
"/dist/matestack-ui-core.js.map"
1215
]
1316
}
1417
},
15-
"matestack-ui-core.css": "/dist/matestack-ui-core.min.css",
16-
"matestack-ui-core.js": "/dist/matestack-ui-core.min.js",
17-
"matestack-ui-core.js.map": "/dist/matestack-ui-core.min.js.map"
18+
"matestack-ui-core.css": "/dist/matestack-ui-core.css",
19+
"matestack-ui-core.css.map": "/dist/matestack-ui-core.css.map",
20+
"matestack-ui-core.js": "/dist/matestack-ui-core.js",
21+
"matestack-ui-core.js.map": "/dist/matestack-ui-core.js.map"
1822
}

vendor/assets/javascripts/dist/matestack-ui-core.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/assets/javascripts/dist/matestack-ui-core.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)