diff --git a/tests/karma/karma.conf.js b/tests/karma/karma.conf.js
deleted file mode 100644
index fa3ebf6a0..000000000
--- a/tests/karma/karma.conf.js
+++ /dev/null
@@ -1,77 +0,0 @@
-// Karma configuration
-// Generated on Sun Jun 26 2016 14:46:31 GMT+0200 (CEST)
-
-module.exports = function(config) {
- config.set({
-
- // base path that will be used to resolve all patterns (eg. files, exclude)
- basePath: '../..',
-
-
- // frameworks to use
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
- frameworks: ['jasmine'],
-
-
- // list of files / patterns to load in the browser
- files: [
- 'openslides/static/js/openslides-libs.js',
- 'node_modules/angular-mocks/angular-mocks.js',
- 'openslides/motions/static/js/motions/linenumbering.js',
- 'openslides/motions/static/js/motions/diff.js',
- 'openslides/core/static/js/core/pdf.js',
- 'tests/karma/*/*.test.js'
- ],
-
-
- // list of files to exclude
- exclude: [
- ],
-
-
- // preprocess matching files before serving them to the browser
- // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
- preprocessors: {
- },
-
-
- // test results reporter to use
- // possible values: 'dots', 'progress'
- // available reporters: https://npmjs.org/browse/keyword/karma-reporter
- reporters: ['progress'],
-
-
- // web server port
- port: 9876,
-
-
- // enable / disable colors in the output (reporters and logs)
- colors: true,
-
-
- // level of logging
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
- logLevel: config.LOG_INFO,
-
- client: {
- captureConsole: true
- },
-
- // enable / disable watching file and executing tests whenever any file changes
- autoWatch: true,
-
-
- // start these browsers
- // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
- browsers: ['Chrome', 'PhantomJS'],
-
-
- // Continuous Integration mode
- // if true, Karma captures browsers, runs the tests and exits
- singleRun: true,
-
- // Concurrency level
- // how many browser should be started simultaneous
- concurrency: Infinity
- })
-}
diff --git a/tests/karma/motions/diff.service.test.js b/tests/karma/motions/diff.service.test.js
deleted file mode 100644
index 5891aa047..000000000
--- a/tests/karma/motions/diff.service.test.js
+++ /dev/null
@@ -1,799 +0,0 @@
-describe('linenumbering', function () {
-
- beforeEach(module('OpenSlidesApp.motions.diff'));
-
- var diffService, baseHtml1, baseHtmlDom1, baseHtml2, baseHtmlDom2, baseHtml3, baseHtmlDom3,
- brMarkup = function (no) {
- return '
' +
- ' ';
- },
- noMarkup = function (no) {
- return ' ';
- };
-
- beforeEach(inject(function (_diffService_, _lineNumberingService_) {
- diffService = _diffService_;
- lineNumberingService = _lineNumberingService_;
-
- baseHtml1 = '
' +
- noMarkup(1) + 'Line 1 ' + brMarkup(2) + 'Line 2 ' +
- brMarkup(3) + 'Line 3
' + noMarkup(4) + 'Line 4 ' + brMarkup(5) + 'Line 5
' + noMarkup(10) + 'Line 10 ' + brMarkup(11) + 'Line 11
'; - baseHtmlDom1 = diffService.htmlToFragment(baseHtml1); - - baseHtml2 = '' + noMarkup(1) + 'Single text line
\ -' + noMarkup(2) + 'sdfsdfsdfsdf dsfsdfsdfdsflkewjrl ksjfl ksdjf klnlkjBavaria ipsum dolor sit amet Biazelt Auffisteign ' + brMarkup(3) + 'Schorsch mim Radl foahn Ohrwaschl Steckerleis wann griagd ma nacha wos z’dringa glacht Mamalad, ' + - brMarkup(4) + 'muass? I bin a woschechta Bayer sowos oamoi und sei und glei wirds no fui lustiga: Jo mei khkhis des ' + brMarkup(5) + 'schee middn ognudelt, Trachtnhuat Biawambn gscheid: Griasd eich midnand etza nix Gwiass woass ma ned ' + - brMarkup(6) + 'owe. Dahoam gscheckate middn Spuiratz des is a gmahde Wiesn. Des is schee so Obazda san da, Haferl ' + brMarkup(7) + 'pfenningguat schoo griasd eich midnand.
\ -' + noMarkup(14) + 'I waar soweid Blosmusi es nomoi. Broadwurschtbudn des is a gmahde Wiesn Kirwa mogsd a Bussal ' + brMarkup(15) + 'Guglhupf schüds nei. Luja i moan oiwei Baamwach Watschnbaam, wiavui baddscher! Biakriagal a fescha ' + - brMarkup(16) + '1Bua Semmlkneedl iabaroi oba um Godds wujn Ledahosn wui Greichats. Geh um Godds wujn luja heid ' + brMarkup(17) + 'greaßt eich nachad woaß Breihaus eam! De om auf’n Gipfe auf gehds beim Schichtl mehra Baamwach a ' + brMarkup(18) + 'bissal wos gehd ollaweil gscheid:
\ -\ -\ -' + noMarkup(19) + 'Scheans Schdarmbeaga See i hob di narrisch gean i jo mei is des schee! Nia eam ' + brMarkup(20) + 'hod vasteh i sog ja nix, i red ja bloß sammawiedaguad, umma eana obandeln! Zwoa ' + brMarkup(21) + 'jo mei scheans amoi, san und hoggd Milli barfuaßat gscheit. Foidweg vui huift ' + - brMarkup(22) + 'vui singan, mehra Biakriagal om auf’n Gipfe! Ozapfa sodala Charivari greaßt eich ' + brMarkup(23) + 'nachad Broadwurschtbudn do middn liberalitas Bavariae sowos Leonhardifahrt:
\ -
' + noMarkup(24) + 'Wui helfgod Wiesn, ognudelt schaugn: Dahoam gelbe Rüam Schneid singan wo hi sauba i moan scho aa no ' + brMarkup(25) + 'a Maß a Maß und no a Maß nimma. Is umananda a ganze Hoiwe zwoa, Schneid. Vui huift vui Brodzeid kumm ' + - brMarkup(26) + 'geh naa i daad vo de allerweil, gor. Woaß wia Gams, damischa. A ganze Hoiwe Ohrwaschl Greichats ' + brMarkup(27) + 'iabaroi Prosd Engelgwand nix Reiwadatschi.Weibaleid ognudelt Ledahosn noch da Giasinga Heiwog i daad ' + - brMarkup(28) + 'Almrausch, Ewig und drei Dog nackata wea ko, dea ko. Meidromml Graudwiggal nois dei, nackata. No ' + brMarkup(29) + 'Diandldrahn nix Gwiass woass ma ned hod boarischer: Samma sammawiedaguad wos, i hoam Brodzeid. Jo ' + - brMarkup(30) + 'mei Sepp Gaudi, is ma Wuascht do Hendl Xaver Prosd eana an a bravs. Sauwedda an Brezn, abfieseln.
'; - baseHtmlDom2 = diffService.htmlToFragment(baseHtml2); - - baseHtml3 = 'Line 1 '); - expect(diff.outerContextStart).toBe(''); - expect(diff.outerContextEnd).toBe(''); - }); - - it('extracts lines from nested UL/LI-structures', function () { - var diff = diffService.extractRangeByLineNumbers(baseHtml1, 7, 9); - expect(diff.html).toBe('Line 7
' + noMarkup(1) + 'Line 1
' + - '' + noMarkup(2) + 'Line 2' + brMarkup(3) + 'Line 3' + brMarkup(4) + 'Line 5
'); - expect(diff.outerContextEnd).toBe('
'); - }); - - it('extracts lines from double-nested UL/LI-structures (2)', function () { - var html = '
' + noMarkup(1) + 'Line 1
' + - '' + noMarkup(2) + 'Line 2' + brMarkup(3) + 'Line 3' + brMarkup(4) + '
Line 2'); - expect(diff.outerContextStart).toBe(''); - expect(diff.outerContextEnd).toBe(''); - expect(diff.innerContextStart).toBe(''); - expect(diff.innerContextEnd).toBe('
'); - }); - - it('extracts a single line right before a UL/LI', function () { - // Test case for https://github.com/OpenSlides/OpenSlides/issues/3226 - var html = "
A line
Another line
\nAnother line
\n"); - }); - - it('extracts lines from a more complex example', function () { - var diff = diffService.extractRangeByLineNumbers(baseHtml2, 6, 11); - - expect(diff.html).toBe('owe. Dahoam gscheckate middn Spuiratz des is a gmahde Wiesn. Des is schee so Obazda san da, Haferl pfenningguat schoo griasd eich midnand.'); - expect(diff.innerContextEnd).toBe('
'); - expect(diff.innerContextEnd).toBe(''); - expect(diff.previousHtmlEndSnippet).toBe('
'); - expect(diff.followingHtml).toBe(''); - expect(diff.followingHtmlStartSnippet).toBe(''); - }); - - it('preserves the numbering of OLs (1)', function () { - var diff = diffService.extractRangeByLineNumbers(baseHtml3, 5, 7); - - expect(diff.html).toBe('' + noMarkup(2) + 'Another line
'; - var diff = diffService.extractRangeByLineNumbers(inHtml, 1, 2); - expect(diff.html).toBe('Replaced a UL by a P
', 6, 9); - expect(merged).toBe('Line 1 Line 2 Line 3
Line 4 Line 5
Replaced a UL by a P
Line 10 Line 11
'); - }); - - it('replaces LIs by another LI', function () { - var merged = diffService.replaceLines(baseHtml1, 'Line 1 Line 2 Line 3
Line 4 Line 5
Line 10 Line 11
'); - }); - - it('breaks up a paragraph into two', function() { - var merged = diffService.replaceLines(baseHtml1, 'Replaced Line 10
Inserted Line 11
', 10, 11); - expect(merged).toBe('Line 1 Line 2 Line 3
Line 4 Line 5
Replaced Line 10
Inserted Line 11 Line 11
'); - }); - - it('does not accidently merge two separate words', function() { - var merged = diffService.replaceLines(baseHtml1, 'Line 1INSERTION
', 1, 2), - containsError = merged.indexOf("Line 1INSERTIONLine 2"), - containsCorrectVersion = merged.indexOf("Line 1INSERTION Line 2"); - expect(containsError).toBe(-1); - expect(containsCorrectVersion).toBe(3); - }); - - it('does not accidently merge two separate words, even in lists', function() { - // The newlines between UL and LI are the problem here - var merged = diffService.replaceLines(baseHtml1, '' + noMarkup(1) + 'foo & bar
', - after = '' + noMarkup(1) + 'foo & bar ins
'; - var merged = diffService.replaceLines(pre, after, 1, 2, true); - expect(merged).toBe('foo & bar ins
'); - }); - }); - - describe('detecting the type of change', function() { - it('detects a simple insertion', function () { - var htmlBefore = 'Test 1
', - htmlAfter = 'Test 1 Test 2
' + "\n" + 'Test 3
'; - var calculatedType = diffService.detectReplacementType(htmlBefore, htmlAfter); - expect(calculatedType).toBe(diffService.TYPE_INSERTION); - }); - - it('detects a simple insertion, ignoring case of tags', function () { - var htmlBefore = 'Test 1
', - htmlAfter = 'Test 1 Test 2
' + "\n" + 'Test 3
'; - var calculatedType = diffService.detectReplacementType(htmlBefore, htmlAfter); - expect(calculatedType).toBe(diffService.TYPE_INSERTION); - }); - - it('detects a simple insertion, ignoring trailing whitespaces', function () { - var htmlBefore = 'Lorem ipsum dolor sit amet, sed diam voluptua. At
', - htmlAfter = 'Lorem ipsum dolor sit amet, sed diam voluptua. At2
'; - var calculatedType = diffService.detectReplacementType(htmlBefore, htmlAfter); - expect(calculatedType).toBe(diffService.TYPE_INSERTION); - }); - - it('detects a simple insertion, ignoring spaces between UL and LI', function () { - var htmlBefore = 'dsds dsfsdfsdf sdf sdfs dds sdf dsds dsfsdfsdf
', - htmlAfter = 'dsds dsfsdfsdf sdf sdfs dds sd345 3453 45f dsds dsfsdfsdf
'; - var calculatedType = diffService.detectReplacementType(htmlBefore, htmlAfter); - expect(calculatedType).toBe(diffService.TYPE_INSERTION); - }); - - it('detects a simple deletion', function () { - var htmlBefore = 'Test 1 Test 2
' + "\n" + 'Test 3
', - htmlAfter = 'Test 1
'; - var calculatedType = diffService.detectReplacementType(htmlBefore, htmlAfter); - expect(calculatedType).toBe(diffService.TYPE_DELETION); - }); - - it('detects a simple deletion, ignoring case of tags', function () { - var htmlBefore = 'Test 1 Test 2
' + "\n" + 'Test 3
', - htmlAfter = 'Test 1
'; - var calculatedType = diffService.detectReplacementType(htmlBefore, htmlAfter); - expect(calculatedType).toBe(diffService.TYPE_DELETION); - }); - - it('detects a simple deletion, ignoring trailing whitespaces', function () { - var htmlBefore = 'Lorem ipsum dolor sit amet, sed diam voluptua. At2
', - htmlAfter = 'Lorem ipsum dolor sit amet, sed diam voluptua. At
'; - var calculatedType = diffService.detectReplacementType(htmlBefore, htmlAfter); - expect(calculatedType).toBe(diffService.TYPE_DELETION); - }); - - it('detects a simple replacement', function () { - var htmlBefore = 'Test 1 Test 2
' + "\n" + 'Test 3
', - htmlAfter = 'Test 1
' + "\n" + 'Test 2
' + "\n" + 'Test 3
'; - var calculatedType = diffService.detectReplacementType(htmlBefore, htmlAfter); - expect(calculatedType).toBe(diffService.TYPE_REPLACEMENT); - }); - }); - - describe('diff normalization', function () { - it('uppercases normal HTML tags', function () { - var unnormalized = 'The brown fox', - normalized = diffService._normalizeHtmlForDiff(unnormalized); - expect(normalized).toBe('The brown fox') - }); - - it('uppercases the names of html attributes, but not the values, and sort the attributes', function () { - var unnormalized = 'This is our cool home page - have a look! ' + - '', - normalized = diffService._normalizeHtmlForDiff(unnormalized); - expect(normalized).toBe('This is our cool home page - have a look! ' + - '') - }); - - it('strips unnecessary spaces', function () { - var unnormalized = "Test
", - normalized = diffService._normalizeHtmlForDiff(unnormalized); - expect(normalized).toBe("Test
"); - }); - - it('treats newlines like spaces', function () { - var unnormalized = "Test line\n\t 2
", - normalized = diffService._normalizeHtmlForDiff(unnormalized); - expect(normalized).toBe("Test line 2
"); - }); - }); - - describe('the core diff algorithm', function () { - it('acts as documented by the official documentation', function () { - var before = "The red brown fox jumped over the rolling log.", - after = "The brown spotted fox leaped over the rolling log."; - var diff = diffService.diff(before, after); - expect(diff).toBe('The" + noMarkup(1) + "Hendl Kirwa hod Maßkruag
" + noMarkup(2) + "gmahde Wiesn
Hendl Kirwa hod Maßkruag
\ngmahde Wiesn
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
", - after = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
\n" + - "\n" + - "Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
"; - var diff = diffService.diff(before, after); - expect(diff).toBe("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
\n" + - "Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
"); - }); - - it('does not result in separate paragraphs when only the first word has changed', function () { - var before = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
', - after = 'Bla ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
'; - var diff = diffService.diff(before, after); - - expect(diff).toBe(' LoremBla ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
Test1 Test2
", - after = "Test1 Test2
"; - var diff = diffService.diff(before, after); - - expect(diff).toBe("Test1 Test2
Test1 Test2
"); - }); - - it('handles inserted paragraphs', function () { - var before = "liebliche Stimme, aber deine Stimme ist rauh; du bist der Wolf.' Da gieng der
", - after = "liebliche Stimme, aber deine Stimme ist rauh; du bist der Wolf.'
\ -\ -Der Wolf hatte danach richtig schlechte laune, trank eine Flasche Rum,
\ -\ -machte eine Weltreise und kam danach wieder um die Ziegen zu fressen. Da ging der
", - expected = "liebliche Stimme, aber deine Stimme ist rauh; du bist der Wolf.' Da gieng der
" + - "liebliche Stimme, aber deine Stimme ist rauh; du bist der Wolf.'
" + - "Der Wolf hatte danach richtig schlechte laune, trank eine Flasche Rum,
" + - "machte eine Weltreise und kam danach wieder um die Ziegen zu fressen. Da ging der
"; - - var diff = diffService.diff(before, after); - expect(diff).toBe(expected); - }); - - it('handles inserted paragraphs (2)', function () { - // Specifically, Noch should not be enclosed by ..., as Noch would be seriously broken - var before = "rief sie alle sieben herbei und sprach 'liebe Kinder, ich will hinaus in den Wald, seid
", - after = "rief sie alle sieben herbei und sprach 'liebe Kinder, ich will hinaus in den Wald, seid Noch
" + - "Test 123
", - expected = "rief sie alle sieben herbei und sprach 'liebe Kinder, ich will hinaus in den Wald, seid Noch
" + - "Test 123
"; - - var diff = diffService.diff(before, after); - expect(diff).toBe(expected); - }); - - it('handles insterted paragraphs (3)', function () { - // Hint: os-split-after should be moved from the first paragraph to the second one - var before = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
", - after = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
\n" + - "\n" + - "Stet clita kasd gubergren, no sea takimata sanctus est.
", - expected = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
\n" + - "Stet clita kasd gubergren, no sea takimata sanctus est.
"; - - var diff = diffService.diff(before, after); - expect(diff).toBe(expected); - }); - - it('handles inserted paragraphs (4)', function () { - var before = "This is a random first line that remains unchanged.
", - after = "This is a random first line that remains unchanged.
" + - 'Inserting this line should not make any troubles, especially not affect the first line
' + - 'Neither should this line
', - expected = "This is a random first line that remains unchanged.
" + - 'Inserting this line should not make any troubles, especially not affect the first line
' + - 'Neither should this line
'; - - var diff = diffService.diff(before, after); - expect(diff).toBe(expected); - }); - - it('handles completely deleted paragraphs', function () { - var before = "Ihr könnt ohne Sorge fortgehen.'Da meckerte die Alte und machte sich getrost auf den Weg.
", - after = ""; - var diff = diffService.diff(before, after); - expect(diff).toBe("Ihr könnt ohne Sorge fortgehen.'Da meckerte die Alte und machte sich getrost auf den Weg.
"); - }); - - it('does not repeat the last word (1)', function () { - var before = "sem. Nulla consequat massa quis enim.
", - after = "sem. Nulla consequat massa quis enim. TEST
\nTEST
sem. Nulla consequat massa quis enim. TEST
TEST
...so frißt er Euch alle mit Haut und Haar.
", - after = "...so frißt er Euch alle mit Haut und Haar und Augen und Därme und alles.
"; - var diff = diffService.diff(before, after); - - expect(diff).toBe("...so frißt er Euch alle mit Haut und Haar und Augen und Därme und alles.
"); - }); - - it('does not break when an insertion followes a beginning tag occuring twice', function () { - var before = "...so frißt er Euch alle mit Haut und Haar.
\nTest
", - after = "Einfügung 1 ...so frißt er Euch alle mit Haut und Haar und Augen und Därme und alles.
\nTest
"; - var diff = diffService.diff(before, after); - - expect(diff).toBe("Einfügung 1 ...so frißt er Euch alle mit Haut und Haar und Augen und Därme und alles.
\nTest
"); - }); - - it('does not lose formattings when multiple lines are deleted', function () { - var before = '' + - noMarkup(13) + 'diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd ' + - brMarkup(14) + 'gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
', - after= 'Test
'; - var diff = diffService.diff(before, after).toLowerCase(), - expected = '' +
- noMarkup(13) + 'diam voluptua. at vero eos et accusam et justo duo dolores et ea rebum. stet clita kasd ' +
- brMarkup(14) + 'gubergren, no sea takimata sanctus est lorem ipsum dolor sit amet.' +
- 'test
...so frißt er Euch alle mit Haut und Haar.
", - after = "...so frißt er Euch alle mit Haut und Haar.
"; - var diff = diffService.diff(before, after); - - expect(diff).toBe('...so frißt er Euch alle mit Haut und Haar.
...so frißt er Euch alle mit Haut und Haar.
'); - }); - - it('removed inline colors in inserted/deleted parts (2)', function () { - var before = "...so frißt er Euch alle mit Haut und Haar.
", - after = "...so frißt er Euch alle mit Haut und Haar.
"; - var diff = diffService.diff(before, after); - - expect(diff).toBe('...so frißt er Euch alle mit Haut und Haar.
...so frißt er Euch alle mit Haut und Haar.
'); - }); - - it('marks a single moved word as deleted and inserted again', function () { - var before = 'tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren bla, no sea takimata sanctus est Lorem ipsum dolor sit amet.
', - after = 'tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd bla, no sea takimata sanctus est Lorem ipsum dolor gubergren sit amet.
'; - var diff = diffService.diff(before, after); - - expect(diff).toBe('tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren bla, no sea takimata sanctus est Lorem ipsum dolor gubergren sit amet.
sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing
', - after = 'sanctus est Lorem ipsum dolor sit amet. Test Lorem ipsum dolor sit amet, consetetur sadipscing
'; - var diff = diffService.diff(before, after); - - expect(diff).toBe('sanctus est Lorem ipsum dolor sit amet. Test Lorem ipsum dolor sit amet, consetetur sadipscing
'); - }); - - it('does not lose words when changes are moved X-wise', function () { - var before = 'elitr. einsetzt. VERSCHLUCKT noch die sog. Gleichbleibend (Wird gelöscht).', - after = 'elitr, Einfügung durch Änderung der Gleichbleibend, einsetzt.'; - - var diff = diffService.diff(before, after); - expect(diff).toBe('elitrLorem ipsum dolor sit amet, consetetur
sadipscing elitr.
Bavaria ipsum dolor sit amet o’ha wea nia ausgähd
kummt nia hoam i hob di narrisch gean
Lorem ipsum dolor sit amet, consetetur sadipscing elitr. Sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua..
\n' +
- 'Bavaria ipsum dolor sit amet o’ha wea nia ausgähd
\n' +
- 'Autonomie erfährt ihre Grenzen
Lorem ipsum dolor sit amet, consetetur sadipscing elitr. Sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua..
Bavaria ipsum dolor sit amet o’ha wea nia ausgähdkummt nia hoam i hob di narrisch geanAutonomie erfährt ihre Grenzen
Test 123
wir strikt ab. lehnen wir ' + brMarkup(1486) + 'ab.
' + noMarkup(1487) + 'Gegenüber
Test 123
\n' +
- 'wir strikt ab. lehnen wir ab.
\n' +
- 'Gegenüber
Test 123
wir strikt ab. lehnen wir ' + brMarkup(1486) + 'ab.
' + noMarkup(1487) + 'Gegenüber
...so frißt er Euch alle mit Haut und Haar.
", - after = "...so frißt er Euch alle mit Haut und Haar und Augen und Därme und alles.
"; - before = lineNumberingService.insertLineNumbers(before, 15, null, null, 2); - var diff = diffService.diff(before, after); - - expect(diff).toBe("" + noMarkup(2) + "...so frißt er " + brMarkup(3) + "Euch alle mit " + brMarkup(4) + "Haut und Haar und Augen und Därme und alles.
"); - }); - - it('works with an inserted paragraph', function () { - var before = "their grammar, their pronunciation and their most common words. Everyone realizes why a
", - after = "their grammar, their pronunciation and their most common words. Everyone realizes why a
\n" + - "NEW PARAGRAPH 2.
"; - - before = lineNumberingService.insertLineNumbers(before, 80, null, null, 2); - var diff = diffService.diff(before, after); - expect(diff).toBe("" + noMarkup(2) + "their grammar, their pronunciation and their most common words. Everyone " + brMarkup(3) + "realizes why a
\n" + - "NEW PARAGRAPH 2.
"); - }); - - it('works with two inserted paragraphs', function () { - // Hint: If the last paragraph is a P again, the Diff still fails and falls back to paragraph-based diff - // This leaves room for future improvements - var before = "their grammar, their pronunciation and their most common words. Everyone realizes why a
\ntheir grammar, their pronunciation and their most common words. Everyone realizes why a
\n" + - "NEW PARAGRAPH 1.
\n" + - "NEW PARAGRAPH 2.
\n" + - "" + noMarkup(2) + "their grammar, their pronunciation and their most common words. Everyone " + brMarkup(3) + "realizes why a
\n" + - "NEW PARAGRAPH 1.
\n" + - "NEW PARAGRAPH 2.
\n" + - "holen, da rief sie alle sieben herbei und sprach:
\n\n \"Liebe Kinder, ich will hinaus in den Wald, seid auf der Hut vor dem Wolf! Wenn er
hereinkommt, frisst er euch alle mit Haut und Haar. Der Bösewicht verstellt sich oft, aber
an der rauen Stimme und an seinen schwarzen Füßen werdet ihr ihn schon erkennen.\"
Die Geißlein sagten: \" Liebe Mutter, wir wollen uns schon in acht nehmen, du kannst ohne
", - after = "holen, da rief sie alle sieben herbei und sprach:
\n\nHello
\n\nWorld
\n\nYa
\n\nDie Geißlein sagten: \" Liebe Mutter, wir wollen uns schon in acht nehmen, du kannst ohne
"; - var diff = diffService.diff(before, after); - expect(diff).toBe("holen, da rief sie alle sieben herbei und sprach:
\"Liebe Kinder, ich will hinaus in den Wald, seid auf der Hut vor dem Wolf! Wenn er
hereinkommt, frisst er euch alle mit Haut und Haar. Der Bösewicht verstellt sich oft, aber
an der rauen Stimme und an seinen schwarzen Füßen werdet ihr ihn schon erkennen.\"
Die Geißlein sagten: \" Liebe Mutter, wir wollen uns schon in acht nehmen, du kannst ohne
" + - "holen, da rief sie alle sieben herbei und sprach:
\n\n" + - "Hello
\n\n" + - "World
\n\n" + - "Ya
\n\n" + - "Die Geißlein sagten: \" Liebe Mutter, wir wollen uns schon in acht nehmen, du kannst ohne
"); - }); - - it('line breaks at dashes does not delete/insert the last/first word of the split lines', function () { - var before = "' + noMarkup(1) + 'foo & bar' + brMarkup(2) + 'Another line' + - brMarkup(3) + 'This will be changed' + brMarkup(4) + 'This, too' + brMarkup(5) + 'End
', - after = '' + noMarkup(1) + 'foo & bar' + brMarkup(2) + 'Another line' + - brMarkup(3) + 'This has been changed' + brMarkup(4) + 'End
'; - - var diff = diffService.diff(before, after); - var affected = diffService.detectAffectedLineRange(diff); - expect(affected).toEqual({"from": 3, "to": 5}); - }); - it('detects changed line numbers at the beginning', function () { - var before = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat
', - after = 'sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat
'; - - before = lineNumberingService.insertLineNumbers(before, 20); - var diff = diffService.diff(before, after); - - var affected = diffService.detectAffectedLineRange(diff); - expect(affected).toEqual({"from": 1, "to": 2}); - }); - }); - - describe('stripping ins/del-styles/tags', function () { - it('deletes to be deleted nodes', function () { - var inHtml = 'Test Test 2 Another test Test 3
Test 4
'; - var stripped = diffService.diffHtmlToFinalText(inHtml); - expect(stripped).toBe('Test Another test
'); - }); - - it('produces empty paragraphs, if necessary', function () { - var inHtml = 'Test Test 2 Another test Test 3
Test 4
'; - var stripped = diffService.diffHtmlToFinalText(inHtml); - expect(stripped).toBe(''); - }); - - it('Removes INS-tags', function () { - var inHtml = 'Test Test 2 Another test
'; - var stripped = diffService.diffHtmlToFinalText(inHtml); - expect(stripped).toBe('Test Test 2 Another test
'); - }); - - it('Removes .insert-classes', function () { - var inHtml = 'Test 1
Test 2
'; - var stripped = diffService.diffHtmlToFinalText(inHtml); - expect(stripped).toBe('Test 1
Test 2
'); - }); - }); -}); diff --git a/tests/karma/motions/linenumbering.service.test.js b/tests/karma/motions/linenumbering.service.test.js deleted file mode 100644 index f02c8d38a..000000000 --- a/tests/karma/motions/linenumbering.service.test.js +++ /dev/null @@ -1,482 +0,0 @@ -describe('linenumbering', function () { - - beforeEach(module('OpenSlidesApp.motions.lineNumbering')); - - var lineNumberingService, - brMarkup = function (no) { - return 'Test 2 3
'; - var out = lineNumberingService.splitToParagraphs(htmlIn); - expect(out.length).toBe(2); - expect(out[0]).toBe('Test 2 3
'); - }); - it('ignores root-level text-nodes', function () { - var htmlIn = 'Node 3
Node 3
Node 3
Node 3
' + noMarkup(2) + 'et accusam et justo duo dolores et ea rebum Inserted Text. Stet clita kasd ' + brMarkup(3) + 'gubergren,
leo Testelefantgeweih Buchstabenwut als Achzehnzahlunginer. Hierbei darfsetzen bist der Deifi das Dor Reh Wachtel da Subjunktivier als Derftige Aalsan Orthopädische, der Arbeitsnachweisdiskus Bass der Tastatur Weiter schreiben wie Tasse Wasser als dienen.
' + noMarkup(1) + 'leo Testelefantgeweih Buchstabenwut als Achzehnzahlunginer. Hierbei darfsetzen bist der Deifi das ' + brMarkup(2) + 'Dor Reh Wachtel da Subjunktivier als Derftige Aalsan Orthopädische, der Arbeitsnachweisdiskus Bass der Tastatur ' + brMarkup(3) + 'Weiter schreiben wie Tasse Wasser als dienen.
et accusam et justo duo dolores et ea rebum Inserted Text. Stet clita kasd gubergren,
' + noMarkup(1) + 'et accusam et justo duo dolores et ea rebum Inserted Text. Stet clita kasd ' + brMarkup(2) + 'gubergren,
Test 123\nTest1
"; - var outHtml = lineNumberingService.insertLineNumbers(inHtml, 5); - expect(outHtml).toBe('' + noMarkup(1) + 'Test ' + brMarkup(2) + "123\n" + brMarkup(3) + 'Test1
'); - }); - }); - - - describe('line numbering: block nodes', function () { - it('leaves a simple DIV untouched', function () { - var inHtml = "' + longstr(100) + '' + longstr(100) + '
' + noMarkup(3) + - 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH' + brMarkup(4) + 'IJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUV' + - '' + noMarkup(5) + - 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZAB' + brMarkup(6) + 'CDEFGHIJKLMNOPQRSTUV
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio.
"; - var outHtml = lineNumberingService.insertLineNumbers(inHtml, 80); - expect(outHtml).toBe('' + noMarkup(1) + 'Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie ' + brMarkup(2) + 'consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan ' + brMarkup(3) + 'et iusto odio.
'); - expect(lineNumberingService.stripLineNumbers(outHtml)).toBe(inHtml); - expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); - }); - - it('breaks before an inline element, if the first word of the new inline element is longer than the remaining line (2)', function () { - var inHtml = "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio.
"; - var outHtml = lineNumberingService.insertLineNumbers(inHtml, 80); - expect(outHtml).toBe('' + noMarkup(1) + 'Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie ' + brMarkup(2) + 'consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan ' + brMarkup(3) + 'et iusto odio.
'); - expect(lineNumberingService.stripLineNumbers(outHtml)).toBe(inHtml); - expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); - }); - - it('does not fail in a weird case', function () { - var inHtml = "seid NochTest 123
"; - var outHtml = lineNumberingService.insertLineNumbers(inHtml, 80); - expect(outHtml).toBe(noMarkup(1) + 'seid Noch' + noMarkup(2) + 'Test 123
'); - expect(lineNumberingService.stripLineNumbers(outHtml)).toBe(inHtml); - expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); - }); - }); - - describe('line numbering in regard to the inline diff', function() { - it('does not count within INS nodes', function () { - var inHtml = "1234 1234 1234 1234"; - var outHtml = lineNumberingService.insertLineNumbers(inHtml, 10); - expect(outHtml).toBe(noMarkup(1) + '1234 1234 1234 ' + brMarkup(2) + '1234'); - expect(lineNumberingService.stripLineNumbers(outHtml)).toBe(inHtml); - expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); - }); - - it('does not create a new line for a trailing INS', function () { - var inHtml = "et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, conseteturdsfsdf23
"; - var outHtml = lineNumberingService.insertLineNumbers(inHtml, 80); - expect(outHtml).toBe('' + noMarkup(1) + 'et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata ' + brMarkup(2) + 'sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, conseteturdsfsdf23
'); - expect(lineNumberingService.stripLineNumbers(outHtml)).toBe(inHtml); - expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); - }); - - it('inserts the line number before the INS, if INS is the first element of the paragraph', function() { - var inHtml = "lauthals 'liebe Kinder, ich will hinaus in den Wald, seid auf der Hut vor dem Wolf!' Und noch etwas mehr Text bis zur nächsten Zeile
"; - var outHtml = lineNumberingService.insertLineNumbers(inHtml, 80); - expect(outHtml).toBe("" + noMarkup(1) + "lauthals 'liebe Kinder, ich will hinaus in den Wald, seid auf der Hut vor dem Wolf!' Und " + brMarkup(2) + "noch etwas mehr Text bis zur nächsten Zeile
"); - expect(lineNumberingService.stripLineNumbers(outHtml)).toBe(inHtml); - expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); - }); - - it('cancels newlines after br-elements', function () { - var inHtml = "Test 123
\nTest 456
" + noMarkup(1) + "Test 123
" + noMarkup(2) + "Test 456
" + noMarkup(1) + "012345 78 01 345678901234567890123456789
"; - var outHtml = lineNumberingService.insertLineBreaksWithoutNumbers(inHtml, 20, true); - expect(outHtml).toBe("" + noMarkup(1) + "012345 78 01
34567890123456789012
3456789
' + longstr(100) + '' + longstr(100) + '
' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH' + plainBr + 'IJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUV' + - '' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZAB' + plainBr + 'CDEFGHIJKLMNOPQRSTUV
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, conseteturdsfsdf23
"; - var outHtml = lineNumberingService.insertLineBreaksWithoutNumbers(inHtml, 80, true); - expect(outHtml).toBe('et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata ' + - plainBr + 'sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur' + - plainBr + 'dsfsdf23
'); - expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); - }); - - it('ignores witespaces by previously added line numbers', function () { - var inHtml = "" + noMarkup(1) + longstr(10) + "
"; - var outHtml = lineNumberingService.insertLineBreaksWithoutNumbers(inHtml, 10, true); - expect(outHtml).toBe("" + noMarkup(1) + longstr(10) + "
"); - expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); - }); - }); - - describe('behavior regarding ckeditor', function() { - it('does not count empty lines, case 1', function () { - var inHtml = "Line 1
\n\nLine 2
"; - var outHtml = lineNumberingService.insertLineNumbers(inHtml, 80); - expect(outHtml).toBe('' + noMarkup(1) + 'Line 1
' + "\n\n" + '' + noMarkup(2) + 'Line 2
'); - }); - - it('does not count empty lines, case 2', function () { - var inHtml = "Line 1
' + - 'Line 2
Line 3
Line 4
' + - 'Line 5
'; - inHtml = lineNumberingService.insertLineNumbers(inHtml, 80); - var structure = lineNumberingService.getHeadingsWithLineNumbers(inHtml); - expect(structure).toEqual([ - {lineNumber: 2, level: 1, text: 'Heading 1'}, - {lineNumber: 4, level: 2, text: 'Heading 1.1'}, - {lineNumber: 6, level: 2, text: 'Heading 1.2'}, - {lineNumber: 8, level: 1, text: 'Heading 2'}, - {lineNumber: 9, level: 2, text: 'Heading 2.1'} - ]); - }); - }); - - describe('caching', function() { - it('caches based on line length', function () { - var inHtml = '' +longstr(100) + '
'; - var outHtml80 = lineNumberingService.insertLineNumbers(inHtml, 80); - var outHtml70 = lineNumberingService.insertLineNumbers(inHtml, 70); - expect(outHtml70).not.toBe(outHtml80); - }); - }); -});