Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-28 21:14:18 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-28 21:14:18 +0300
commitb267f3a3acf3fe4cf2a9bb254d7abeb3b2823b21 (patch)
treea1c30c9a460a1c990311d47aae72d00368e1a1c1 /spec/lib/rouge/formatters
parent03cd4f8da4f848c7dfd0c0b88b4c095f69e56bb0 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/rouge/formatters')
-rw-r--r--spec/lib/rouge/formatters/html_gitlab_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/rouge/formatters/html_gitlab_spec.rb b/spec/lib/rouge/formatters/html_gitlab_spec.rb
index 4bc9b256dce..7c92c62e30b 100644
--- a/spec/lib/rouge/formatters/html_gitlab_spec.rb
+++ b/spec/lib/rouge/formatters/html_gitlab_spec.rb
@@ -36,5 +36,26 @@ RSpec.describe Rouge::Formatters::HTMLGitlab do
is_expected.to eq(code)
end
end
+
+ context 'when unicode control characters are used' do
+ let(:lang) { 'javascript' }
+ let(:tokens) { lexer.lex(code, continue: false) }
+ let(:code) do
+ <<~JS
+ #!/usr/bin/env node
+
+ var accessLevel = "user";
+ if (accessLevel != "user‮ ⁦// Check if admin⁩ ⁦") {
+ console.log("You are an admin.");
+ }
+ JS
+ end
+
+ it 'highlights the control characters' do
+ message = "Potentially unwanted character detected: Unicode BiDi Control"
+
+ is_expected.to include(%{<span class="unicode-bidi has-tooltip" data-toggle="tooltip" title="#{message}">}).exactly(4).times
+ end
+ end
end
end