blob: 3760d6bd43516290bcf21c5930bc52a13c92b32b (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'IDE user sees editor info', :js do
include WebIdeSpecHelpers
let_it_be(:project) { create(:project, :public, :repository) }
let_it_be(:user) { project.owner }
before do
sign_in(user)
ide_visit(project)
end
it 'shows line position' do
ide_open_file('README.md')
within find('.ide-status-bar') do
expect(page).to have_content('1:1')
end
ide_set_editor_position(4, 10)
within find('.ide-status-bar') do
expect(page).not_to have_content('1:1')
expect(page).to have_content('4:10')
end
end
it 'updates after rename' do
ide_open_file('README.md')
ide_set_editor_position(4, 10)
within find('.ide-status-bar') do
expect(page).to have_content('markdown')
expect(page).to have_content('4:10')
end
ide_rename_file('README.md', 'READMEZ.txt')
within find('.ide-status-bar') do
expect(page).to have_content('plaintext')
expect(page).to have_content('1:1')
end
end
it 'persists position after rename' do
ide_open_file('README.md')
ide_set_editor_position(4, 10)
ide_open_file('files/js/application.js')
ide_rename_file('README.md', 'READING_RAINBOW.md')
ide_open_file('READING_RAINBOW.md')
within find('.ide-status-bar') do
expect(page).to have_content('4:10')
end
end
it 'persists position' do
ide_open_file('README.md')
ide_set_editor_position(4, 10)
ide_close_file('README.md')
ide_open_file('README.md')
within find('.ide-status-bar') do
expect(page).to have_content('markdown')
expect(page).to have_content('4:10')
end
end
it 'persists viewer' do
ide_open_file('README.md')
click_link('Preview Markdown')
within find('.md-previewer') do
expect(page).to have_content('testme')
end
# Switch away from and back to the file
ide_open_file('.gitignore')
ide_open_file('README.md')
# Preview is still enabled
within find('.md-previewer') do
expect(page).to have_content('testme')
end
end
end
|