Some links does not include _panel suffix. Add if needed.

Yep. Sounds like a hack.

+ Use the right URL anchor with `_panel` in href for each tab

+ update specs
This commit is contained in:
Jean-Baptiste Bellet
2023-05-24 15:46:56 +02:00
parent fc21fdb485
commit 916b2313ab
3 changed files with 6 additions and 3 deletions

View File

@@ -6,7 +6,7 @@
.columns.small-12.large-8
- shop_tabs.each do |tab|
.page
%a{ id: tab[:name], href: "##{tab[:name]}", data: { action: "tabs-and-panels#changeActivePanel tabs-and-panels#changeActiveTab", "tabs-and-panels-target": "tab" }, class: ("selected" if tab[:default]) }=tab[:title]
%a{ id: tab[:name], href: "##{tab[:name]}_panel", data: { action: "tabs-and-panels#changeActivePanel tabs-and-panels#changeActiveTab", "tabs-and-panels-target": "tab" }, class: ("selected" if tab[:default]) }=tab[:title]
.columns.large-4.show-for-large-up
= render partial: "shopping_shared/order_cycles"
- shop_tabs.each do |tab|

View File

@@ -23,7 +23,10 @@ export default class extends Controller {
if (anchor[0] == "/") {
anchor = anchor.slice(1);
}
// Add _panel to the anchor to match the panel id if needed
if (!anchor.includes("_panel")) {
anchor = `${anchor}_panel`;
}
this.updateActivePanel(anchor);
// tab

View File

@@ -183,7 +183,7 @@ describe 'White label setting' do
it "shows the groups tab" do
visit main_app.enterprise_shop_path(distributor)
expect(page).to have_selector "a[href='#groups']"
expect(page).to have_selector "a[href='#groups_panel']"
end
end
end