Skip to content

Commit

Permalink
fix mfix test for mobile view
Browse files Browse the repository at this point in the history
  • Loading branch information
digitaltom committed Feb 9, 2025
1 parent 79e512d commit 0031d29
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
6 changes: 6 additions & 0 deletions app/assets/stylesheets/modals.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@
height 0.3s linear !important;
}

@media (width > 574px) {
.modal-pull-up {
height: auto;
}
}

.modal-pull-up-half {
height: 50% !important;
transition:
Expand Down
4 changes: 1 addition & 3 deletions app/javascript/controllers/map/feature_modal_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ export default class extends Controller {
pullUpModal (modal) {
modal.classList.remove('modal-pull-down')
// console.log('screen width: ' + screen.width)
if (screen.width <= 574) {
modal.classList.add('modal-pull-up')
}
modal.classList.add('modal-pull-up')
}

getFeature () {
Expand Down
4 changes: 2 additions & 2 deletions app/views/maps/modals/_feature.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
%i.bi.bi-trash

%h4#feature-details-header.flex-container
#feature-symbol{ 'data-action': "click->map--feature-modal#toggleModalSize"}
#feature-title{ 'data-action': "click->map--feature-modal#toggleModalSize"}
#feature-symbol
#feature-title

= render 'maps/modals/feature/edit_ui'
= render 'maps/modals/feature/edit_raw'
Expand Down
6 changes: 3 additions & 3 deletions spec/features/feature_details_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
expect(page).to have_css('#feature-details-modal')
end

it 'can enlarge modal with pull-up button' do
page.current_window.resize_to(290, 523)
it 'can enlarge modal with pull-up button', :mobile do
# page.current_window.resize_to(290, 523)
height = find('#feature-details-modal').native.style('height').sub('px', '').to_i
expect(height).to be < 150
find('.modal-pull-button').click
sleep(0.3)
height = find('#feature-details-modal').native.style('height').sub('px', '').to_i
expect(height).to be > 150
page.current_window.resize_to(1024, 576)
# page.current_window.resize_to(1024, 576)
end
end
end
Expand Down
7 changes: 7 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
end
end

config.around(:each, :mobile) do |spec|
browser = Capybara.current_session.driver.browser
browser.manage.window.resize_to(290, 523)
spec.run
browser.manage.window.resize_to(1024, 576)
end

# raise on js console errors
class JavaScriptError< StandardError; end
RSpec.configure do |config|
Expand Down

0 comments on commit 0031d29

Please sign in to comment.