gitlab-org--gitlab-foss/spec/support/matchers/issuable_matchers.rb
Douwe Maan 838f7e56a4
Remove .wiki and @md-typography mixin in favor of .md and .md-file
Before, the styling for `img:not(.emoji)`` was repeated between
`.md:not(.use-csslab):not(.wiki)` (for comments and the Markdown
preview), `.documentation.wiki` (for help pages), and
`.issuable-details .description .wiki` (for MR and issue descriptions).

In these places, we now simply use `.md`. Wherever we use `.md` but
don't want this image styling (like wikis and blobs), `.md-file` is
added.
2019-03-26 14:29:33 +01:00

11 lines
445 B
Ruby

RSpec::Matchers.define :have_header_with_correct_id_and_link do |level, text, id, parent = ".md"|
match do |actual|
node = find("#{parent} h#{level} a#user-content-#{id}")
expect(node[:href]).to end_with("##{id}")
# Work around a weird Capybara behavior where calling `parent` on a node
# returns the whole document, not the node's actual parent element
expect(find(:xpath, "#{node.path}/..").text).to eq(text)
end
end