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

No longer adds start attribute to unordered lists #1901

Merged

Conversation

walid-i
Copy link
Contributor

@walid-i walid-i commented Aug 31, 2021

No description provided.

Copy link
Contributor

@FrenjaminBanklin FrenjaminBanklin left a comment

Choose a reason for hiding this comment

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

It looks like this was branched from a pretty old commit - the most recent tag in this branch is v11.2.0, dev/16.

All pull requests should also target the latest dev branch - at the moment, that is dev/25-bixbite.

Target the latest dev branch (dev/25-bixbite), then either merge that branch into this one or make a new branch from dev/25 and rewrite these changes on that new branch.

@walid-i walid-i changed the base branch from master to dev/25-bixbite September 9, 2021 18:55
@FrenjaminBanklin FrenjaminBanklin changed the base branch from dev/25-bixbite to dev/26-neon-apatite September 14, 2021 14:51
@FrenjaminBanklin FrenjaminBanklin added the hacktoberfest Viable to be worked on for Hacktoberfest label Oct 5, 2021
@FrenjaminBanklin FrenjaminBanklin changed the base branch from dev/26-neon-apatite to dev/28-jadeite March 1, 2022 18:59
Copy link
Contributor

@FrenjaminBanklin FrenjaminBanklin left a comment

Choose a reason for hiding this comment

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

There are snapshot failures in this obonode's viewer component tests that need to be resolved - depending on the test this may mean simply updating the snapshot, but if the snapshot should still be correct then make sure there aren't new bugs.

You should also make sure the tests are thorough with regards to the new functionality - make sure that the start attribute is present for ordered lists and absent for unordered lists.

@@ -164,6 +156,7 @@ describe('List Styles', () => {
const ls = new ListStyles('ordered')

expect(ls.get(0).toDescriptor()).toEqual({
//
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
//

@FrenjaminBanklin FrenjaminBanklin changed the base branch from dev/28-jadeite to dev/29-sodalite August 26, 2022 20:20
@RachelDau RachelDau changed the base branch from dev/29-sodalite to dev/30-howlite January 11, 2023 18:29
@RachelDau RachelDau self-assigned this Jan 11, 2023
@RachelDau
Copy link
Contributor

I removed the extra comments and cleaned up the code. I also fixed the snapshot failures by running yarn test -u. I have not yet verified that this all functions and fulfills the task yet.

Copy link
Contributor

@FrenjaminBanklin FrenjaminBanklin left a comment

Choose a reason for hiding this comment

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

In general I wouldn't suggest using the -u flag since it'll just update all snapshots. I tend to go through failing snapshots one at a time and make sure that the changes to the snapshot are what I would expect them to be based on the changes to the code.

That said, these snapshot changes seem to be fine. Not sure why a caliper-related snapshot was still hanging around or what this PR has to do with it, but I'll let that one go since it shouldn't have still been there anyway.

I think it would also be prudent to explicitly test that unordered lists don't have a start attribute and that ordered lists do have a start attribute.

@RachelDau
Copy link
Contributor

"I think it would also be prudent to explicitly test that unordered lists don't have a start attribute and that ordered lists do have a start attribute."

To do this, would I add this expectation to the list-styles.test.js file that is already edited on this PR ?

@FrenjaminBanklin
Copy link
Contributor

I would probably make a new test(...) for each but yeah, pretty much.

@RachelDau RachelDau force-pushed the issue/1279-no-start-element branch 4 times, most recently from 30c8759 to f91fa42 Compare January 25, 2023 14:28
@RachelDau RachelDau force-pushed the issue/1279-no-start-element branch from f91fa42 to 999f245 Compare January 25, 2023 15:08
@RachelDau
Copy link
Contributor

RachelDau commented Jan 25, 2023

I wrote two unit tests. One that checks that ordered lists have a start attribute ( I check the existence is 'true'), and the other that checks that unordered lists do not have a start attribute (I check that the existence is 'undefined').

Please review that these accomplish the intent and are a good way to verify.

test('all unordered lists dont have a start attribute', () => {
const ls = new ListStyles()
ls.init()
if (ls.type === 'unordered') {
Copy link
Contributor

@FrenjaminBanklin FrenjaminBanklin Jan 27, 2023

Choose a reason for hiding this comment

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

Given the expectation for ls.type to be one or the other, these conditions are unnecessary. In a worst-case scenario, not that I know how this might happen, this conditional could allow the test to pass even if the expectations are not met, since the expectations might not be checked at all.

Also this is just nitpicking, but if unordered is the default behavior, I would keep a test where it is not set (to make sure it's the default behavior) and also a separate test explicitly setting 'unordered' to make sure everything still reacts properly.

Copy link
Contributor

Choose a reason for hiding this comment

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

I made these changes and took a closer look at the unit test for ordered which was filing with the removal of the condition. I learned ls.init() sets the style to unordered so I removed this line. I added ls.get(indent) as it calls other functions that seem to set up the list including adding the start attribute if it is ordered. I think this function would be called to create a list with defaults so I think it is a better way to test that these three unit tests function properly.
A start attribute is not automatically added when const ls = new ListStyles('ordered') is created so this test was failing before I called ls.get(indent) which returns getStyleWithDefaults(indent, this.type, this.styles[indent]) as seen in list-styles.js

Copy link
Contributor

@FrenjaminBanklin FrenjaminBanklin left a comment

Choose a reason for hiding this comment

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

ul elements in the viewer no longer have a 'start' attribute, everything else looks like it's running well.

@FrenjaminBanklin FrenjaminBanklin merged commit 715de4c into ucfopen:dev/30-howlite Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Viable to be worked on for Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants