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

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

describe('Editing Operations', function() {
	var testFileName = 'undo_redo.odt';

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

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

	function undo() {
		helper.typeIntoDocument('Hello World');

		helper.typeIntoDocument('{ctrl}z');

		helper.selectAllText();

		helper.expectTextForClipboard('\nHello \n');
	}

	it('Undo', function() {
		undo();
	});


	it('Redo', function() {
		undo();
		helper.typeIntoDocument('{ctrl}y');

		helper.selectAllText();

		helper.expectTextForClipboard('\nHello World');
	});

	it('Repair Document', function() {
		helper.typeIntoDocument('Hello World');

		cy.get('#menu-editmenu').click()
			.get('#menu-repair').click();

		cy.get('.leaflet-popup-content table').should('exist');

		cy.contains('.leaflet-popup-content table tbody tr','Typing: “World”')
			.dblclick();

		helper.selectAllText();

		helper.expectTextForClipboard('\nHello \n');
	});
});