Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
spec snippet
describe 'Previewing', :js do
let(:preview_content) { "Some changes. What they will look like?".freeze }
context "a new page", focus:true do
it 'will not show the preview changes the first time' do
visit refinery.admin_pages_path
find('a', text: 'Add new page').trigger(:click)
fill_in "Title", :with => "My first page"
page.evaluate_script("WYMeditor.INSTANCES[1].html('<p>Some changes. What they will look like?</p>')")
window = window_opened_by do
click_button "Preview"
end
expect_window_without_content(preview_content, window: window)
window.close
end
it 'will show the preview changes the second time' do
visit refinery.admin_pages_path
find('a', text: 'Add new page').trigger(:click)
fill_in "Title", :with => "My first page"
page.evaluate_script("WYMeditor.INSTANCES[1].html('<p>Some changes. What they will look like?</p>')")
# first click
window = window_opened_by do
click_button "Preview"
end
window.close
# second click
window = window_opened_by do
click_button "Preview"
end
expect_window_with_content(preview_content, window: window)
window.close
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.