diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-16 15:09:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-16 15:09:12 +0300 |
commit | cbfe03ae04a52d9825ff7cbeccdfe5d313adf6a2 (patch) | |
tree | e4879b35d019d3bbba1689f3ac4c48b81bf7b451 /spec/features/markdown | |
parent | 3fd97b4bba24ca412112aad025a38a32c7a6cf8c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/markdown')
-rw-r--r-- | spec/features/markdown/mermaid_spec.rb | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/spec/features/markdown/mermaid_spec.rb b/spec/features/markdown/mermaid_spec.rb index 1cd5760c30e..4bf7edf98ca 100644 --- a/spec/features/markdown/mermaid_spec.rb +++ b/spec/features/markdown/mermaid_spec.rb @@ -38,7 +38,9 @@ describe 'Mermaid rendering', :js do visit project_issue_path(project, issue) - expected = '<text><tspan xml:space="preserve" dy="1em" x="1">Line 1</tspan><tspan xml:space="preserve" dy="1em" x="1">Line 2</tspan></text>' + wait_for_requests + + expected = '<text style=""><tspan xml:space="preserve" dy="1em" x="1">Line 1</tspan><tspan xml:space="preserve" dy="1em" x="1">Line 2</tspan></text>' expect(page.html.scan(expected).count).to be(4) end @@ -121,4 +123,40 @@ describe 'Mermaid rendering', :js do expect(svg[:width].to_i).to eq(100) expect(svg[:height].to_i).to eq(0) end + + it 'display button when diagram exceeds length', :js do + graph_edges = "A-->B;B-->A;" * 420 + + description = <<~MERMAID + ```mermaid + graph LR + #{graph_edges} + ``` + MERMAID + + project = create(:project, :public) + issue = create(:issue, project: project, description: description) + + visit project_issue_path(project, issue) + + page.within('.description') do + expect(page).not_to have_selector('svg') + + expect(page).to have_selector('pre.mermaid') + + expect(page).to have_selector('.lazy-alert-shown') + + expect(page).to have_selector('.js-lazy-render-mermaid-container') + end + + wait_for_requests + + find('.js-lazy-render-mermaid').click + + page.within('.description') do + expect(page).to have_selector('svg') + + expect(page).not_to have_selector('.js-lazy-render-mermaid-container') + end + end end |