2020-11-24 15:15:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
# These helpers help you interact within the Source Editor (single-file editor, snippets, etc.).
|
2020-11-24 15:15:51 +05:30
|
|
|
#
|
|
|
|
module Spec
|
|
|
|
module Support
|
|
|
|
module Helpers
|
|
|
|
module Features
|
2021-09-30 23:02:18 +05:30
|
|
|
module SourceEditorSpecHelpers
|
2020-11-24 15:15:51 +05:30
|
|
|
include ActionView::Helpers::JavaScriptHelper
|
|
|
|
|
|
|
|
def editor_set_value(value)
|
|
|
|
editor = find('.monaco-editor')
|
|
|
|
uri = editor['data-uri']
|
|
|
|
|
|
|
|
execute_script("monaco.editor.getModel('#{uri}').setValue('#{escape_javascript(value)}')")
|
|
|
|
end
|
|
|
|
|
|
|
|
def editor_get_value
|
|
|
|
editor = find('.monaco-editor')
|
|
|
|
uri = editor['data-uri']
|
|
|
|
|
|
|
|
evaluate_script("monaco.editor.getModel('#{uri}').getValue()")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|