File tree Expand file tree Collapse file tree 2 files changed +31
-10
lines changed
Expand file tree Collapse file tree 2 files changed +31
-10
lines changed Original file line number Diff line number Diff line change @@ -96,9 +96,6 @@ class TestComponent2 < React::Component::Base
9696 end
9797
9898 it "adding child to a new model on client after render" do
99- # Hyperloop.configuration do |config|
100- # #config.transport = :none
101- # end
10299 m = FactoryBot . create ( :test_model )
103100 m . child_models << FactoryBot . create ( :child_model )
104101 mount "TestComponent2" do
@@ -122,6 +119,30 @@ def self.add_child
122119 page . should have_content ( "parent has 3 children" )
123120 end
124121
122+ it "preserves the order of children" do
123+ isomorphic do
124+ ChildModel . class_eval do
125+ server_method :do_some_calc do
126+ child_attribute
127+ end
128+ end
129+ TestModel . class_eval do
130+ server_method :do_some_calc do
131+ child_models . collect ( &:child_attribute ) . join ( ', ' )
132+ end
133+ end
134+ end
135+ expect_promise do
136+ parent = TestModel . new
137+ 4 . times do |i |
138+ parent . child_models << ChildModel . new ( child_attribute : i . to_s )
139+ end
140+ ReactiveRecord . load do
141+ parent . do_some_calc . tap { parent . child_models [ 3 ] . do_some_calc }
142+ end
143+ end . to eq ( '0, 1, 2, 3' )
144+ end
145+
125146 it "will re-render the count after an item is added or removed from a model" do
126147 m1 = FactoryBot . create ( :test_model )
127148 mount "TestComponent2" do
Original file line number Diff line number Diff line change @@ -271,13 +271,13 @@ class ActiveRecord::Base
271271 # DatabaseCleaner.start
272272 # end
273273
274- config . after ( :each ) do |example |
275- unless example . exception
276- # Clear session data
277- Capybara . reset_sessions!
278- # Rollback transaction
279- DatabaseCleaner . clean
280- end
274+ config . after ( :each ) do # |example|
275+ # unless example.exception
276+ # Clear session data
277+ Capybara . reset_sessions!
278+ # Rollback transaction
279+ DatabaseCleaner . clean
280+ # end
281281 end
282282
283283 config . after ( :all , :js => true ) do
You can’t perform that action at this time.
0 commit comments