Skip to content

Commit

Permalink
Fix copy element feature
Browse files Browse the repository at this point in the history
With the introduction of the Element Editor decorator this
feature broke.

Instead of using the class of the element_editor local variable
we use the remarkable type string that we exactly know in this case.
  • Loading branch information
tvdeyen committed Jan 12, 2021
1 parent aa874d0 commit 69cb01e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/alchemy/admin/elements/_element_toolbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% remarkable_type = element.class.name.demodulize.underscore.pluralize %>
<% remarkable_type = "elements" %>
<div class="element-toolbar">
<span class="element_tools">
<div class="button_with_label">
Expand Down
13 changes: 13 additions & 0 deletions spec/features/admin/edit_elements_feature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,17 @@
expect(page).to have_selector(".add-nestable-element-button")
end
end

describe "Copy element", :js do
let!(:element) { create(:alchemy_element, page: a_page) }

scenario "is possible to copy element into clipboard" do
visit alchemy.admin_elements_path(page_id: element.page_id)
expect(page).to have_selector(".element-toolbar")
find(".fa-clone").click
within "#flash_notices" do
expect(page).to have_content(/Copied Article/)
end
end
end
end

0 comments on commit 69cb01e

Please sign in to comment.