File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 2727 expect ( @comment . commentable ) . to eq @hardball
2828 end
2929
30+ it 'clears the selected id on type change' , js : true do
31+ @players = [ 'Jackie Robinson' , 'Rob Wooten' ] . map { |name | FactoryBot . create :player , name : name }
32+ visit new_path ( model_name : 'comment' )
33+ select 'Player' , from : 'comment[commentable_type]'
34+ find ( 'input.ra-filtering-select-input' ) . set ( 'Rob' )
35+ page . execute_script ( "document.querySelector('input.ra-filtering-select-input').dispatchEvent(new KeyboardEvent('keydown'))" )
36+ expect ( page ) . to have_selector ( 'ul.ui-autocomplete li.ui-menu-item a' )
37+ page . execute_script %{[...document.querySelectorAll('ul.ui-autocomplete li.ui-menu-item')].find(e => e.innerText.includes("Jackie Robinson")).click()}
38+ select 'Team' , from : 'comment[commentable_type]'
39+ expect ( find ( '#comment_commentable_id' , visible : false ) . value ) . to eq ''
40+ end
41+
3042 context 'when the associated model is declared in a two-level namespace' do
3143 it 'successfully saves the record' , js : true do
3244 polymorphic_association_tests = [ 'Jackie Robinson' , 'Rob Wooten' ] . map do |name |
Original file line number Diff line number Diff line change @@ -258,7 +258,7 @@ import I18n from "./i18n";
258258 "options"
259259 ) ;
260260 object_select . data ( "options" , selected_data ) ;
261- object_select . val ( '' ) ;
261+ object_select . val ( "" ) ;
262262 object_select . filteringSelect ( "destroy" ) ;
263263 object_select . filteringSelect ( selected_data ) ;
264264 } ) ;
You can’t perform that action at this time.
0 commit comments