File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
admin/lib/solidus_admin/testing_support/shared_examples Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 2121
2222RSpec . shared_examples_for "features: sortable" do
2323 let ( :factory_attrs ) { { } }
24+ let ( :scope ) { "body" }
2425
2526 before do
2627 create ( factory , displayed_attribute => "First" , position : 1 , **factory_attrs )
2930 end
3031
3132 it "allows sorting via drag and drop" do
32- row_1 = find_row ( "First" )
33- row_2 = find_row ( "Second" )
33+ within ( scope ) do
34+ rows = find ( "[data-controller='sortable']" ) . all ( :xpath , "./*" )
35+ rows [ 1 ] . drag_to rows [ 0 ]
3436
35- row_2 . drag_to row_1
36-
37- expect ( find ( "table tbody tr:first-child" ) ) . to have_text ( "Second" )
38- expect ( find ( "table tbody tr:last-child" ) ) . to have_text ( "First" )
37+ expect ( find ( "[data-controller='sortable']" ) . all ( :xpath , "./*" ) . first ) . to have_text ( "Second" )
38+ expect ( find ( "[data-controller='sortable']" ) . all ( :xpath , "./*" ) . last ) . to have_text ( "First" )
39+ end
3940 end
4041end
You can’t perform that action at this time.
0 commit comments