Skip to content

Commit 433b4f6

Browse files
committed
Places command controller on list for handling template initialization on DOM
1 parent 6977aa7 commit 433b4f6

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

lib/protos/combobox.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def empty(...)
4444
def default_attrs
4545
{
4646
data: {
47-
controller: "protos--popover protos--command",
47+
controller: "protos--popover",
4848
"protos--popover-options-value": JSON.generate(options)
4949
}
5050
}

lib/protos/command.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def empty(...)
4242

4343
def default_attrs
4444
{
45-
data: { controller: "protos--command protos--modal" }
45+
data: { controller: "protos--modal" }
4646
}
4747
end
4848
end

lib/protos/command/list.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ def template(&block)
99

1010
private
1111

12+
def default_attrs
13+
{
14+
data: { controller: "protos--command" }
15+
}
16+
end
17+
1218
def theme
1319
{
1420
container: tokens("menu")

spec/protos/combobox_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
end
1111

1212
it "adds the stimulus controllers" do
13-
expect(page).to have_css("[data-controller='protos--popover protos--command']")
13+
expect(page).to have_css("[data-controller='protos--popover']")
1414
end
1515
end

spec/protos/command/list_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@
1212
it "adds the styles" do
1313
expect(page).to have_css(".menu")
1414
end
15+
16+
it "connects the stimulus controller for command" do
17+
expect(page).to have_css("[data-controller='protos--command']")
18+
end
1519
end

spec/protos/command_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@
88
it "renders the container" do
99
expect(page).to have_content "Test"
1010
end
11+
12+
it "connects the stimulus controller for the modal" do
13+
expect(page).to have_css("[data-controller='protos--modal']")
14+
end
1115
end

0 commit comments

Comments
 (0)