1# frozen_string_literal: true
2
3module QA
4  module Page
5    module File
6      module Shared
7        module Editor
8          extend QA::Page::PageConcern
9
10          def self.included(base)
11            super
12
13            base.view 'app/views/projects/blob/_editor.html.haml' do
14              element :editor
15            end
16          end
17
18          def add_content(content)
19            text_area.set content
20          end
21
22          def remove_content
23            text_area.send_keys([:command, 'a'], :backspace)
24          end
25
26          private
27
28          def text_area
29            within_element :editor do
30              find('textarea', visible: false)
31            end
32          end
33        end
34      end
35    end
36  end
37end
38