diff --git a/tests/manual/table.html b/tests/manual/table.html index feae0e74..60a63c81 100644 --- a/tests/manual/table.html +++ b/tests/manual/table.html @@ -6,199 +6,18 @@
-

Complex table:

- -
-
Data about the planets of our solar system (Planetary facts taken from Nasa's Planetary Fact Sheet - Metric. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 NameMass (1024kg)Diameter (km)Density (kg/m3)Gravity (m/s2)Length of day (hours)Distance from Sun (106km)Mean temperature (°C)Number of moonsNotes
Terrestrial planetsMercury0.3304,87954273.74222.657.91670Closest to the Sun
Venus4.8712,10452438.92802.0108.24640 
Earth5.9712,75655149.824.0149.6151Our world
Mars0.6426,79239333.724.7227.9-652The red planet
Jovian planetsGas giantsJupiter1898142,984132623.19.9778.6-11067The largest planet
Saturn568120,5366879.010.71433.5-14062 
Ice giantsUranus86.851,11812718.717.22872.5-19527 
Neptune10249,528163811.016.14495.1-20014 
Dwarf planetsPluto0.01462,37020950.7153.35906.4-2255Declassified as a planet in 2006, but this remains controversial. -
-
- -

Table with 2 tbody:

- - - - - - - - - - -
abc
a b c
- -

Table with no tbody:

- - - - - - - -
a b c
abc
- -

Table with thead section between two tbody sections

- - - - - - - - - - - - - - - - -
2
1
3
+

Model contents:

+
diff --git a/tests/manual/table.js b/tests/manual/table.js index cf1c8ff1..53a9dd96 100644 --- a/tests/manual/table.js +++ b/tests/manual/table.js @@ -3,13 +3,14 @@ * For licensing, see LICENSE.md. */ -/* globals console, window, document */ +/* globals console, window, document, global */ import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset'; import Table from '../../src/table'; import TableToolbar from '../../src/tabletoolbar'; import TableSelection from '../../src/tableselection'; +import { getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; ClassicEditor .create( document.querySelector( '#editor' ), { @@ -23,7 +24,32 @@ ClassicEditor } ) .then( editor => { window.editor = editor; + editor.model.document.on( 'change', () => { + printModelContents( editor ); + } ); + + printModelContents( editor ); } ) .catch( err => { console.error( err.stack ); } ); + +const modelDiv = global.document.querySelector( '#model' ); + +function printModelContents( editor ) { + modelDiv.innerText = formatTable( getData( editor.model ) ); +} + +function formatTable( tableString ) { + return tableString + .replace( //g, '\n
' ) + .replace( //g, '\n\n ' ) + .replace( //g, '\n\n ' ) + .replace( //g, '\n\n ' ) + .replace( //g, '\n\n ' ) + .replace( /<\/tableRow>/g, '\n' ) + .replace( /<\/thead>/g, '\n' ) + .replace( /<\/tbody>/g, '\n' ) + .replace( /<\/tr>/g, '\n' ) + .replace( /<\/table>/g, '\n
' ); +}