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

blob_spec_helpers.rb « features « helpers « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 880a724928429c461b88269ef9c601a5fccb7ead (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

# These helpers help you interact within the blobs page and blobs edit page (Single file editor).
module BlobSpecHelpers
  include ActionView::Helpers::JavaScriptHelper

  def set_default_button(type)
    evaluate_script("localStorage.setItem('gl-web-ide-button-selected', '#{type}')")
  end

  def unset_default_button
    set_default_button('')
  end

  def editor_value
    evaluate_script('monaco.editor.getModels()[0].getValue()')
  end

  def set_editor_value(value)
    execute_script("monaco.editor.getModels()[0].setValue('#{value}')")
  end
end