Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for remaining fake selection in advance tab of table properties #599

Merged
merged 7 commits into from
Jul 25, 2017

Conversation

msamsel
Copy link
Contributor

@msamsel msamsel commented Jul 3, 2017

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

yes

This PR contains

  • Unit tests
  • Manual tests

What changes did you make?

Move classes to dataset attributes

close #579

@f1ames f1ames self-requested a review July 13, 2017 06:47
@@ -9,6 +9,7 @@
var fakeSelectedClass = 'cke_table-faked-selection',
fakeSelectedTableClass = fakeSelectedClass + '-table',
fakeSelectedEditorClass = fakeSelectedClass + '-editor',
fakeSelectedTableDatasetClass = 'cke-table-faked-selection-table',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more like fakeSelectedTableDataAttribute

@@ -251,7 +252,7 @@

if ( cells.length > 0 ) {
editor.editable().addClass( fakeSelectedEditorClass );
cells[ 0 ].getAscendant( 'table' ).addClass( fakeSelectedTableClass );
cells[ 0 ].getAscendant( 'table' ).data( fakeSelectedTableDatasetClass, fakeSelectedTableClass );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could just use data( fakeSelectedTableDatasetClass, true );?

While the data attribute is removed in line selectedCells.getItem( 0 ).getAscendant( 'table' ).data( fakeSelectedTableDatasetClass, false ); so it can be only present when cells are selected. In this case shorter value could be used (and then you could also simplify CSS selector to check only if attribute is present).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used empty string. Setting true just parse it to string, so it reflects with result of attribute: data-cke-table-faked-selection-table="true".
Unfortunately method data is combination of setter and getter, so I cannot omit 2nd attribute when I want to use it as a setter.
Current approach seems to be most convenient. Another option would be design some simple general purpose data attribute, like data-cke-class and assign class values, but it might be confusing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense 👍 .
It is similar behaviour to how Boolean attributes works (e.g. input[checked]). Here we also have only two values, selected / not selected so it is a proper approach IMHO.


bender.editor = true;

var test = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use bender.test( { ... } ).

bender.editor = true;

var test = {
'test advance table dialog for ignorig selection class': function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put issue reference link here.


var bot = this.editorBot;

// add table with fake selection.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start sentence with an uppercase.

1. Right click and select `Table Properties`
1. Make sure that selection is now fake (selection colour change to grey)
1. Go to `Avanced` tab
1. Check `Stylesheet Classes`, it should be empty
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be Expected result, not a part of repro steps.

@bender-ui: collapsed
@bender-ckeditor-plugins: dialogadvtab,table,tableselection,wysiwygarea

1. Select at least to 2 cells in table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Select at least to 2 cells in table.

@bender-ckeditor-plugins: dialogadvtab,table,tableselection,wysiwygarea

1. Select at least to 2 cells in table
1. Right click and select `Table Properties`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always end sentences with a ..


1. Select at least to 2 cells in table
1. Right click and select `Table Properties`
1. Make sure that selection is now fake (selection colour change to grey)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(selection colour changed to grey)

@@ -0,0 +1,11 @@
@bender-tags: 4.7.2, tc, bug, 579
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tc tag is not longer used.

Copy link
Contributor

@f1ames f1ames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small thing left.


bot.dialog( 'tableProperties', function( dialog ) {
assert.areSame( '', dialog.getValueOf( 'advanced', 'advCSSClasses' ) );
dialog.hide();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to hide dialog here, especially that it happens after assert so does not have any effect on the test result. This line can be simply removed.

Copy link
Contributor

@f1ames f1ames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@f1ames f1ames merged commit c5dc934 into master Jul 25, 2017
@f1ames f1ames deleted the t/579 branch July 25, 2017 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants