Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Tests: New cases which include ranges in blocks in OT tests #1494

Merged
merged 13 commits into from
Aug 16, 2018
Merged

Conversation

Mgsy
Copy link
Member

@Mgsy Mgsy commented Aug 8, 2018

Suggested merge commit message (convention)

Tests: New cases which include ranges in blocks in OT tests. Closes ckeditor/ckeditor5#4385 .


Additional information

  • Unfortunately, some scenarios fail.
  • Additionally, I moved all remove attribute scenarios to the attribute.js file.

@Mgsy Mgsy requested a review from pjasiun August 8, 2018 08:40
@coveralls
Copy link

coveralls commented Aug 8, 2018

Coverage Status

Coverage decreased (-0.9%) to 97.947% when pulling 0f9779e on t/1470 into f7f2837 on master.

@Mgsy Mgsy requested review from scofalik and removed request for pjasiun August 8, 2018 12:54
expectClients( '<paragraph>BarFoo</paragraph>' );
} );

it( 'remove attribute from text with 2 attributes in same path', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd change those examples so that typing is in the remove attribute range.


it( 'remove attribute from text in different path', () => {
john.setData( '<paragraph>F[oo]</paragraph><paragraph>Bar</paragraph>' );
kate.setData( '<paragraph>Foo</paragraph><paragraph>[Bar]</paragraph>' );
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no attribute to remove here.

@@ -376,6 +532,21 @@ describe( 'transform', () => {
);
} );

it( 'text into div in different path', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like this example because it is rather unrealistic. We do not wrap text. And it is bad to have <p><div></div></p> structure, casue <div> should never be in <p>.

Unless it won't have a negative impact on CC, I'd drop this one.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree with you. I added this kind of tests to treat them as theoretical cases where the range is inside an element. I believe it won't have any impact on CC, so if you're up to remove those (there are more in other files), I'm ok with that.

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed those cases, but there will be one remaining, which has an impact on CC.

@@ -407,6 +578,18 @@ describe( 'transform', () => {
'</blockQuote>'
);
} );

it( 'text into div in same path', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

as above

@@ -440,6 +623,21 @@ describe( 'transform', () => {
);
} );

it( 'text in different path', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We will need to work on those names later cause they aren't really helpful (aren't describing exactly what happens). I understand that we don't want to make sentences of description but it would be good to have more meaningful names. BTW. I am not perfect at that either.


it( 'text in same path', () => {
john.setData( '<blockQuote><paragraph>[Foo]</paragraph></blockQuote>' );
kate.setData( '<blockQuote><paragraph>[Foo]</paragraph></blockQuote>' );
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 a little more correct to have a collapsed selection at the beginning (inside, not before) of unwrapped element. So instead of [Foo] -> []Foo.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean, it doesn't make any difference (at least right now) but I know that in other places I've used the collapsed-selection-notation so it would be good to be consistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Although maybe it even look better when all the unwrapped content is in the selection. But OTOH, it might give someone an idea that you can partially unwrap an element.

expectClients( '<paragraph>o</paragraph>' );
} );

it( 'remove attribute from text with 2 attributes in same path', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about having a test that removes part of non-changed and part of the changed text (changed = removed attributes)?

);
} );

it( 'remove attribute from text in different path', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Theres no attribute here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

} );

// This should be moved to attribute.js.
describe( 'by remove attribute', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you removed those tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved all remove attribute tests to the attribute.js file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, didn't see that cause attribute.js was not expanded. What about the wrap test?

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops, I see that wrap, unwrap and split don't have this kind of tests. I'll add them.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've meant that there is a removed test in move.js: 'intersecting wrap'. I've commented on that below.

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops, I see that wrap, unwrap and split don't have this kind of tests. I'll add them.

Done.

@@ -644,99 +669,6 @@ describe( 'transform', () => {
} );
} );

// Should be in attribute.js.
describe( 'by remove attribute', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you removed those tests?

@@ -224,21 +224,6 @@ describe( 'transform', () => {
'</blockQuote>'
);
} );

it( 'intersecting wrap', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you removed that test?

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed it, because wrap was on text, not element. We decided to remove those cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -594,94 +590,33 @@ describe( 'transform', () => {

expectClients( '<paragraph>FooBar</paragraph>' );
} );
} );

describe( 'by remove attribute', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you removed those tests?

} );
} );

describe( 'by remove attribute', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you removed those tests?

@@ -15,94 +15,6 @@ describe( 'transform', () => {
} );

describe( 'rename', () => {
describe( 'by remove attribute', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you removed those tests?

@scofalik scofalik merged commit c6014a4 into master Aug 16, 2018
@scofalik scofalik deleted the t/1470 branch August 16, 2018 08:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants