summaryrefslogtreecommitdiffstats
path: root/cypress_test/integration_tests/desktop/impress/apply_font_spec.js
blob: 8bd121265030140e1897d89a59d6548e5dc6b1e4 (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
/* global describe it cy beforeEach require afterEach*/

var helper = require('../../common/helper');
var impressHelper = require('../../common/impress_helper');

describe('Apply font on selected text.', function() {
	var origTestFileName = 'apply_font_text.odp';
	var testFileName;

	beforeEach(function() {
		testFileName = helper.beforeAll(origTestFileName, 'impress');

		cy.get('#toolbar-up > .w2ui-scroll-right')
			.click();

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

		impressHelper.selectTextShapeInTheCenter();
	});

	afterEach(function() {
		helper.afterAll(testFileName, this.currentTest.state);
	});

	it('Apply font name',function() {
		cy.get('#toolbar-up > .w2ui-scroll-left')
			.click();

		impressHelper.selectTextOfShape();

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

		cy.contains('.select2-results__option','Linux Libertine G')
			.click();

		impressHelper.triggerNewSVGForShapeInTheCenter();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
			.should('have.attr', 'font-family', 'Linux Libertine G');
	});


	it('Apply font size.', function() {
		impressHelper.selectTextOfShape();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
			.should('have.attr', 'font-size', '635px');

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

		cy.contains('.select2-results__option','24')
			.click();

		impressHelper.triggerNewSVGForShapeInTheCenter();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
			.should('have.attr', 'font-size', '847px');
	});


	it('Apply bold font', function() {
		impressHelper.selectTextOfShape();

		helper.clickOnIdle('#tb_editbar_item_bold');

		impressHelper.triggerNewSVGForShapeInTheCenter();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
			.should('have.attr', 'font-weight', '700');
	});

	it('Apply italic font.', function() {
		impressHelper.selectTextOfShape();

		helper.clickOnIdle('#tb_editbar_item_italic');

		impressHelper.triggerNewSVGForShapeInTheCenter();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
			.should('have.attr', 'font-style', 'italic');
	});


	it('Apply underline.', function() {
		impressHelper.selectTextOfShape();

		helper.clickOnIdle('#tb_editbar_item_underline');

		impressHelper.triggerNewSVGForShapeInTheCenter();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
			.should('have.attr', 'text-decoration', 'underline');
	});

	it('Apply strikeout.', function() {
		impressHelper.selectTextOfShape();

		helper.clickOnIdle('#tb_editbar_item_strikeout');

		impressHelper.triggerNewSVGForShapeInTheCenter();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
			.should('have.attr', 'text-decoration', 'line-through');
	});

	it('Apply font color.', function() {
		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition tspan')
			.should('have.attr', 'fill', 'rgb(0,0,0)');

		impressHelper.selectTextOfShape();

		helper.clickOnIdle('#tb_editbar_item_fontcolor');

		cy.get('.color[name="FF011B"]')
			.click();

		impressHelper.triggerNewSVGForShapeInTheCenter();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition tspan')
			.should('have.attr', 'fill', 'rgb(255,1,27)');
	});

	it('Apply highlight color.', function() {
		impressHelper.selectTextOfShape();

		helper.clickOnIdle('#tb_editbar_item_backcolor');

		cy.get('.color[name="FF011B"]')
			.click();

		impressHelper.triggerNewSVGForShapeInTheCenter();

		// TODO: highlight color is not in the SVG
		// At least check the mobile wizard's state
		cy.wait(400);

		impressHelper.selectTextOfShape();

		helper.clickOnIdle('#tb_editbar_item_backcolor');

		cy.get('.color[name="FF011B"]').eq(0)
			.should('have.text', '•    ');
	});

	it('Apply superscript on selected text.', function() {
		impressHelper.selectTextOfShape();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition')
			.should('have.attr', 'y', '3495');

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
			.should('have.attr', 'font-size', '635px');

		helper.typeIntoDocument('{ctrl}{shift}p');

		impressHelper.triggerNewSVGForShapeInTheCenter();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition')
			.should('have.attr', 'y', '3285');

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
			.should('have.attr', 'font-size', '368px');
	});

	it('Apply subscript on selected text.', function() {
		impressHelper.selectTextOfShape();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition')
			.should('have.attr', 'y', '3495');

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
			.should('have.attr', 'font-size', '635px');

		helper.typeIntoDocument('{ctrl}{shift}b');

		impressHelper.triggerNewSVGForShapeInTheCenter();

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition')
			.should('have.attr', 'y', '3546');

		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph')
			.should('have.attr', 'font-size', '368px');
	});
});