我正在尝试在我的Rails应用程序中测试summernote 0.8.1.0
的实现。
我意识到fill_in
无效,因为fill_in
仅适用于html表单元素,而summernote使用的是带有contenteditable
属性的DIV。
我从这里找到了一个解决方案:https://stackoverflow.com/a/30921215/1713912,但它对我不起作用。
非常感谢任何解决方案的想法!
我的测试:
it "allows admins to add text blocks to events", js: true, focus: true do
click_on "Add text block"
expect(page).to have_content "Text block content"
all("div[contenteditable]").last.set("Dummy text")
click_on "Publish now"
expect(page).to have_content "Event created successfully"
expect(Event.last.text_blocks.last.text_attachment.content).to eq "Dummy text"
end
1) events feature event creation adding content blocks allows admins to add text blocks to events
Failure/Error: expect(Event.last.text_blocks.last.text_attachment.content).to eq "Dummy text"
expected: "Dummy text"
got: ""
(compared using ==)
# ./spec/features/event_feature_spec.rb:76:in `block (4 levels) in <top (required)>'
# -e:1:in `<main>'