Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/203022

Change subject: Add tests for TableAction#changeStyle and TableAction#caption
......................................................................

Add tests for TableAction#changeStyle and TableAction#caption

Bug: T95415
Change-Id: I7bff9ebe2174f31bc5a772fb73d2ccc8c46dc190
---
M tests/ui/actions/ve.ui.TableAction.test.js
1 file changed, 76 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/22/203022/1

diff --git a/tests/ui/actions/ve.ui.TableAction.test.js 
b/tests/ui/actions/ve.ui.TableAction.test.js
index 076ae9e..74d22e2 100644
--- a/tests/ui/actions/ve.ui.TableAction.test.js
+++ b/tests/ui/actions/ve.ui.TableAction.test.js
@@ -25,7 +25,7 @@
        surface.destroy();
 }
 
-QUnit.test( 'create / insert / mergeCells / delete', function ( assert ) {
+QUnit.test( 'create / insert / mergeCells / delete / changeCellStyle / 
caption', function ( assert ) {
        var i,
                expected = 0,
                tableCellTail = [
@@ -406,6 +406,81 @@
                                },
                                expectedSelection: { type: 'null' },
                                msg: 'delete column'
+                       },
+                       {
+                               html: ve.dm.example.mergedCellsHtml,
+                               selection: {
+                                       type: 'table',
+                                       tableRange: new ve.Range( 0, 171 ),
+                                       fromCol: 1,
+                                       fromRow: 0,
+                                       toCol: 2,
+                                       toRow: 1
+                               },
+                               method: 'changeCellStyle',
+                               args: [ 'header' ],
+                               expectedData: function ( data ) {
+                                       data[8].attributes.style = 'header';
+                                       data[13].attributes.style = 'header';
+                                       data[40].attributes.style = 'header';
+                               },
+                               msg: 'change style to header'
+                       },
+                       {
+                               html: ve.dm.example.mergedCellsHtml,
+                               selection: {
+                                       type: 'table',
+                                       tableRange: new ve.Range( 0, 171 ),
+                                       fromCol: 0,
+                                       fromRow: 0,
+                                       toCol: 0,
+                                       toRow: 0
+                               },
+                               method: 'caption',
+                               args: [],
+                               expectedData: function ( data ) {
+                                       data.splice( 1, 0,
+                                               { type: 'tableCaption' },
+                                               { type: 'paragraph', internal: 
{ generated: 'wrapper' } },
+                                               { type: '/paragraph' },
+                                               { type: '/tableCaption' }
+                                       );
+                               },
+                               expectedSelection: {
+                                       type: 'linear',
+                                       range: new ve.Range( 3 )
+                               },
+                               msg: 'add caption'
+                       },
+                       {
+                               html: 
'<table><caption>Foo</caption><tr><td>Bar</td></tr></table>',
+                               selection: {
+                                       type: 'table',
+                                       tableRange: new ve.Range( 0, 20 ),
+                                       fromCol: 0,
+                                       fromRow: 0,
+                                       toCol: 0,
+                                       toRow: 0
+                               },
+                               method: 'caption',
+                               args: [],
+                               expectedData: function ( data ) {
+                                       data.splice( 1, 7 );
+                               },
+                               msg: 'remove caption from table selection'
+                       },
+                       {
+                               html: 
'<table><caption>Foo</caption><tr><td>Bar</td></tr></table>',
+                               selection: {
+                                       type: 'linear',
+                                       range: new ve.Range( 5 )
+                               },
+                               method: 'caption',
+                               args: [],
+                               expectedData: function ( data ) {
+                                       data.splice( 1, 7 );
+                               },
+                               msg: 'remove caption from linear selection 
inside caption'
                        }
                ];
 

-- 
To view, visit https://gerrit.wikimedia.org/r/203022
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7bff9ebe2174f31bc5a772fb73d2ccc8c46dc190
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to