File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ class ActiveAdmin::Views::Pages::Base
3
3
4
4
def build ( *args )
5
5
original_build ( args )
6
+ body = get_elements_by_tag_name ( "body" ) . first
6
7
body . set_attribute "data-default-select" , ActiveadminAddons . default_select
7
8
end
8
9
end
Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ def to_html
16
16
end
17
17
18
18
def input_html_options
19
- super . merge ( control_attributes )
19
+ # maxwidth and size are added by Formtastic::Inputs::StringInput
20
+ # but according to the HTML standard these are not valid attributes
21
+ # on the inputs provided by this module
22
+ super . except ( :maxlength , :size ) . merge ( control_attributes )
20
23
end
21
24
22
25
def parts_to_html
Original file line number Diff line number Diff line change 76
76
expect ( page ) . to have_selector ( "select.select2" )
77
77
end
78
78
end
79
+
80
+ context "when building ActiveAdmin html" do
81
+ describe "the <body> element" do
82
+ it "is present in the document only once" do
83
+ visit admin_invoices_path
84
+
85
+ expect ( page . all ( 'body' ) . size ) . to eq 1
86
+ end
87
+
88
+ it "contains the data-default-select attribute" do
89
+ visit admin_invoices_path
90
+
91
+ body = find ( "body" )
92
+ expect ( body [ 'data-default-select' ] ) . to eq ActiveadminAddons . default_select
93
+ end
94
+ end
95
+ end
79
96
end
You can’t perform that action at this time.
0 commit comments