summaryrefslogtreecommitdiff
path: root/qa/qa/page/file/shared/editor.rb
blob: 448c09cfbca73038ca390b56422598509c32fd20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true

module QA
  module Page
    module File
      module Shared
        module Editor
          def self.included(base)
            base.view 'app/views/projects/blob/_editor.html.haml' do
              element :editor
            end
          end

          def add_content(content)
            text_area.set content
          end

          def remove_content
            text_area.send_keys([:command, 'a'], :backspace)
          end

          private

          def text_area
            within_element :editor do
              find('textarea', visible: false)
            end
          end
        end
      end
    end
  end
end