Feature: Automatically skip steps with missing attachTo elements, resolves #6
This commit is contained in:
parent
eac8e10471
commit
5aba3471fe
4
.gitignore
vendored
4
.gitignore
vendored
@ -3,8 +3,12 @@ capybara-*.html
|
||||
.rspec
|
||||
/log
|
||||
/tmp
|
||||
/test/dummy/log
|
||||
/test/dummy/tmp
|
||||
/db/*.sqlite3
|
||||
/db/*.sqlite3-journal
|
||||
/test/dummy/db/*.sqlite3
|
||||
/test/dummy/db/*.sqlite3-journal
|
||||
/public/system
|
||||
/coverage/
|
||||
/spec/tmp
|
||||
|
@ -32,6 +32,10 @@
|
||||
text: "<%= step['text'] %>",
|
||||
<% if step.key?('attachTo') %>
|
||||
attachTo: { element: "<%= step['attachTo']['element'] %>", on: "<%= step['attachTo']['placement'] %>" },
|
||||
showOn: function() {
|
||||
// Only display this step if its selector is present
|
||||
return document.querySelector("<%= step['attachTo']['element'] %>") ? true : false
|
||||
},
|
||||
<% end %>
|
||||
buttons: [
|
||||
<% if index == 0 %>
|
||||
|
@ -1,4 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
module Abraham
|
||||
VERSION = '1.1.1'
|
||||
VERSION = '1.2'
|
||||
end
|
||||
|
@ -6,6 +6,12 @@ intro:
|
||||
title: "ENGLISH This step has a title"
|
||||
text: "ENGLISH This intermediate step has some text"
|
||||
3:
|
||||
title: "ENGLISH A missing step"
|
||||
text: "ENGLISH Refers to an element that won't exist on the page, should skip to 4"
|
||||
attachTo:
|
||||
element: "#i-dont-exist"
|
||||
position: "right"
|
||||
4:
|
||||
title: "ENGLISH The final step"
|
||||
text: "ENGLISH Some text here too, and it's attached to the right"
|
||||
attachTo:
|
||||
|
@ -6,6 +6,12 @@ intro:
|
||||
title: "SPANISH This step has a title"
|
||||
text: "This intermediate step has some text"
|
||||
3:
|
||||
title: "SPANISH A missing step"
|
||||
text: "Refers to an element that won't exist on the page, should skip to 4"
|
||||
attachTo:
|
||||
element: "#i-dont-exist"
|
||||
position: "right"
|
||||
4:
|
||||
title: "SPANISH The final step"
|
||||
text: "Some text here too, and it's attached to the right"
|
||||
attachTo:
|
||||
|
Binary file not shown.
Binary file not shown.
@ -31,6 +31,9 @@ class DashboardControllerTest < ActionDispatch::IntegrationTest
|
||||
assert element.text.include? 'step-1'
|
||||
assert element.text.include? 'step-2'
|
||||
assert element.text.include? 'step-3'
|
||||
assert element.text.include? 'step-4'
|
||||
# Generates a showOn option
|
||||
assert element.text.include? 'showOn:'
|
||||
# it will post the right completion information
|
||||
assert element.text.include? "controller_name: 'dashboard'"
|
||||
assert element.text.include? "action_name: 'home'"
|
||||
|
Loading…
x
Reference in New Issue
Block a user