File tree 2 files changed +30
-2
lines changed
assets/javascripts/discourse/components
2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -194,10 +194,10 @@ export default class ParamInputForm extends Component {
194
194
case " category_id" :
195
195
return digitalizeCategoryId (value);
196
196
case " boolean" :
197
- if (value == null ) {
197
+ if (value == null || value === " #null " ) {
198
198
return info .nullable ? " #null" : false ;
199
199
}
200
- return value;
200
+ return value === " true " ;
201
201
case " group_id" :
202
202
case " group_list" :
203
203
const normalized = this .normalizeGroups (value);
Original file line number Diff line number Diff line change 26
26
-- bigint :bigint_with_default = 12345678912345
27
27
-- boolean :boolean
28
28
-- null boolean :boolean_three_with_default = #null
29
+ -- boolean :boolean_with_default = true
29
30
-- string :string_with_default = little bunny foo foo
30
31
-- date :date_with_default = 14 jul 2015
31
32
-- time :time_with_default = 5:02 pm
67
68
. create_from_sql ( ALL_PARAMS_SQL )
68
69
. each do |param |
69
70
expect ( page ) . to have_css ( ".query-params .param [name=\" #{ param . identifier } \" ]" )
71
+
72
+ # select-kit fields
73
+ ignore_fields = %i[ user_id post_id topic_id category_id group_id group_list user_list ]
74
+
75
+ if param . default . present? && ignore_fields . exclude? ( param . type )
76
+ expect ( page ) . to have_field (
77
+ param . identifier ,
78
+ with : simple_normalize ( param . type , param . default ) ,
79
+ )
80
+ end
70
81
end
71
82
end
72
83
end
84
+
85
+ def simple_normalize ( type , value )
86
+ case type
87
+ when :date
88
+ value . to_date . to_s
89
+ when :time
90
+ value . to_time . strftime ( "%H:%M" )
91
+ when :datetime
92
+ value . to_datetime . strftime ( "%Y-%m-%dT%H:%M" )
93
+ when :boolean
94
+ value == "#null" ? "#null" : value ? "on" : "off"
95
+ when :boolean_three
96
+ value == "#null" ? "#null" : value ? "Y" : "N"
97
+ else
98
+ value . to_s
99
+ end
100
+ end
You can’t perform that action at this time.
0 commit comments