Menu icon Foundation

Developer | Paris

My Posts

No Content

My Comments

Dimitri Jorge commented on Isaac Elias's post about 5 years

Hi,

I have the same issue and investigated it a little bit.

Rails 4.1.4
Capybara 2.4.1
Rspec 2.99

My spec looks like this:

visit some_path
page.find('#triggerMyModal').click
page.should have_selector('#someModal')

I have the following template (with some debug on it):

:javascript
  function debug() {
    console.log("DEBUG GOT CALLED")
    // When I uncomment the following, the modal appears correctly
    // $('#someModal').foundation('reveal', 'open')
  }

%a#triggerMyModal(href="javascript:debug()" data-reveal-id="someModal")
  %i.fa.fa-plus
   Add

#someModal.reveal-modal(data-reveal)
  .reveal-body= render 'some_content'

When I click on the link through rspec, the debug gets printed correctly however the modal does not open (I use save_and_open_screenshot to check it). When I uncomment the section in the "debug" function, everything works correctly. I guess the listener on "[data-reveal-id]" does not get correctly plugged.

Anyone has an idea on how I can run my test without an ugly fix? Thanks

Posts Followed

No Content

Following

    No Content

Followers

My Posts

No Content

My Comments

You commented on Isaac Elias's post about 5 years

Hi,

I have the same issue and investigated it a little bit.

Rails 4.1.4
Capybara 2.4.1
Rspec 2.99

My spec looks like this:

visit some_path
page.find('#triggerMyModal').click
page.should have_selector('#someModal')

I have the following template (with some debug on it):

:javascript
  function debug() {
    console.log("DEBUG GOT CALLED")
    // When I uncomment the following, the modal appears correctly
    // $('#someModal').foundation('reveal', 'open')
  }

%a#triggerMyModal(href="javascript:debug()" data-reveal-id="someModal")
  %i.fa.fa-plus
   Add

#someModal.reveal-modal(data-reveal)
  .reveal-body= render 'some_content'

When I click on the link through rspec, the debug gets printed correctly however the modal does not open (I use save_and_open_screenshot to check it). When I uncomment the section in the "debug" function, everything works correctly. I guess the listener on "[data-reveal-id]" does not get correctly plugged.

Anyone has an idea on how I can run my test without an ugly fix? Thanks

Posts Followed

No Content

Following

  • No Content

Followers

  • No Content