summaryrefslogtreecommitdiffstats
path: root/cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js
blob: fbfe80aedd0118553be8982d72ac3fab4b84e816 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
/* global describe it cy beforeEach require afterEach*/

var helper = require('../../common/helper');
var mobileHelper = require('../../common/mobile_helper');
var writerMobileHelper = require('./writer_mobile_helper');

describe('Pushing bottom toolbar items.', function() {
	var testFileName = 'bottom_toolbar.odt';

	beforeEach(function() {
		helper.beforeAll(testFileName, 'writer');

		// Click on edit button
		mobileHelper.enableEditingMobile();

		// Do a new selection
		writerMobileHelper.selectAllMobile();
	});

	afterEach(function() {
		helper.afterAll(testFileName);
	});

	it('Apply bold.', function() {
		cy.get('#tb_editbar_item_bold div table')
			.should('not.have.class', 'checked');

		cy.get('#tb_editbar_item_bold')
			.click();

		cy.get('#tb_editbar_item_bold div table')
			.should('have.class', 'checked');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p b')
			.should('exist');
	});

	it('Apply italic.', function() {
		cy.get('#tb_editbar_item_italic div table')
			.should('not.have.class', 'checked');

		cy.get('#tb_editbar_item_italic')
			.click();

		cy.get('#tb_editbar_item_italic div table')
			.should('have.class', 'checked');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p i')
			.should('exist');
	});
	it('Apply underline.', function() {
		cy.get('#tb_editbar_item_underline div table')
			.should('not.have.class', 'checked');

		cy.get('#tb_editbar_item_underline')
			.click();

		cy.get('#tb_editbar_item_underline div table')
			.should('have.class', 'checked');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p u')
			.should('exist');
	});

	it('Apply strikeout.', function() {
		cy.get('#tb_editbar_item_strikeout div table')
			.should('not.have.class', 'checked');

		cy.get('#tb_editbar_item_strikeout')
			.click();

		cy.get('#tb_editbar_item_strikeout div table')
			.should('have.class', 'checked');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p strike')
			.should('exist');
	});

	it('Apply text color.', function() {
		cy.get('#tb_editbar_item_fontcolor')
			.click();

		mobileHelper.selectFromColorPalette(0, 7);

		cy.get('.w2ui-tb-image.w2ui-icon.textcolor')
			.should('have.attr', 'style', 'box-shadow: rgb(255, 255, 255) 0px -2px inset, rgb(0, 0, 255) 0px -6px inset;');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p font')
			.should('have.attr', 'color', '#0000ff');
	});

	it('Apply highlight color.', function() {
		cy.get('#tb_editbar_item_backcolor')
			.click();

		mobileHelper.selectFromColorPalette(0, 9);

		cy.get('.w2ui-tb-image.w2ui-icon.backcolor')
			.should('have.attr', 'style', 'box-shadow: rgb(255, 255, 255) 0px -2px inset, rgb(255, 0, 255) 0px -6px inset;');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p font span')
			.should('have.attr', 'style', 'background: #ff00ff');
	});

	it('Apply left / right paragraph alignment.', function() {
		cy.get('#tb_editbar_item_rightpara div table')
			.should('not.have.class', 'checked');

		cy.get('#tb_editbar_item_rightpara')
			.click();

		cy.get('#tb_editbar_item_rightpara div table')
			.should('have.class', 'checked');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p')
			.should('have.attr', 'align', 'right');

		cy.get('#tb_editbar_item_leftpara div table')
			.should('not.have.class', 'checked');

		cy.get('#tb_editbar_item_leftpara')
			.click();

		cy.get('#tb_editbar_item_leftpara div table')
			.should('have.class', 'checked');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p')
			.should('have.attr', 'align', 'left');
	});

	it('Apply center paragraph alignment.', function() {
		cy.get('#tb_editbar_item_centerpara div table')
			.should('not.have.class', 'checked');

		cy.get('#tb_editbar_item_centerpara')
			.click();

		cy.get('#tb_editbar_item_centerpara div table')
			.should('have.class', 'checked');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p')
			.should('have.attr', 'align', 'center');
	});

	it('Apply justify paragraph alignment.', function() {
		cy.get('#tb_editbar_item_justifypara div table')
			.should('not.have.class', 'checked');

		cy.get('#tb_editbar_item_justifypara')
			.click();

		cy.get('#tb_editbar_item_justifypara div table')
			.should('have.class', 'checked');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p')
			.should('have.attr', 'align', 'justify');
	});

	it('Apply default numbering.', function() {
		cy.get('#tb_editbar_item_defaultnumbering div table')
			.should('not.have.class', 'checked');

		cy.get('#tb_editbar_item_defaultnumbering')
			.click();

		cy.get('#tb_editbar_item_defaultnumbering div table')
			.should('have.class', 'checked');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container ol li p')
			.should('exist');
	});

	it('Apply default bulleting.', function() {
		cy.get('#tb_editbar_item_defaultbullet div table')
			.should('not.have.class', 'checked');

		cy.get('#tb_editbar_item_defaultbullet')
			.click();

		cy.get('#tb_editbar_item_defaultbullet div table')
			.should('have.class', 'checked');

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container ul li p')
			.should('exist');
	});

	it('Increase / decrease indent.', function() {
		cy.get('#tb_editbar_item_incrementindent')
			.click().click();

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p')
			.should('have.attr', 'style')
			.should('contain', 'margin-left: 0.98in');

		cy.get('#tb_editbar_item_decrementindent')
			.click();

		writerMobileHelper.selectAllMobile();

		cy.get('#copy-paste-container p')
			.should('have.attr', 'style')
			.should('contain', 'margin-left: 0.49in');
	});
});