diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-03-14 15:27:05 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-03-14 15:29:31 -0600 |
commit | 9a0a4f17a42d15c1d228c4e3ec845291d1123b5c (patch) | |
tree | c1732d6f80b254bc0310c2179f1a8c61b1168e24 /spec/features/copy_as_gfm_spec.rb | |
parent | f90909307e27bdc176becb30ba01805d243fbbdd (diff) | |
download | gitlab-ce-9a0a4f17a42d15c1d228c4e3ec845291d1123b5c.tar.gz |
Remove selectionToGFMdm-copy-code-as-gfm
Diffstat (limited to 'spec/features/copy_as_gfm_spec.rb')
-rw-r--r-- | spec/features/copy_as_gfm_spec.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/features/copy_as_gfm_spec.rb b/spec/features/copy_as_gfm_spec.rb index 45f3213c308..ce34f48aaaf 100644 --- a/spec/features/copy_as_gfm_spec.rb +++ b/spec/features/copy_as_gfm_spec.rb @@ -579,10 +579,15 @@ describe 'Copy as GFM', feature: true, js: true do def html_to_gfm(html, transformer = 'transformGFMSelection') js = <<-JS.strip_heredoc (function(html) { + var transformer = window.gl.CopyAsGFM[#{transformer.inspect}]; + var node = document.createElement('div'); node.innerHTML = html; - var transformer = window.gl.CopyAsGFM[#{transformer.inspect}]; - return window.gl.CopyAsGFM.selectionToGFM(node, transformer); + + node = transformer(node); + if (!node) return null; + + return window.gl.CopyAsGFM.nodeToGFM(node); })("#{escape_javascript(html)}") JS page.evaluate_script(js) |