-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add Ancillary feature #204
Conversation
Should also handle rename/remove/etc
The orphans appear outside of all books, at the bottom of the tree view
Might be better to use `capabilities`, an array of words like 'delete', 'rename', etc., to support conditions Example: we may not want to allow removing an orphaned subbook/page
Mostly to address a problem with the tsconfig file, but it's probably better this way anyway
I was stuck on this for a bit. Initially I tried to write the srcBookToc immediately after removing the node on model-manager.ts:594. The tests kept failing because the page was being orphaned instead of appearing in the second book. I realized that the sideEffectFn was running which overwrote `this.bookTocs` with a new array. This meant that the splice (model-manager.ts:597) was modifying a different list of children because the reference returned by `lookupToken` was not the same as the one stored in `bookToc`. I moved my write operation to the end and added a warning. Hopefully the warning will save someone else from this confusion in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but there are some things not covered by tests. If I look at the html report (in .nyc_output/lcov-report
after running npm run test:unit
) it looks like most of the uncovered parts are where the functions return early if no title is entered.
In my opinion, it's fine to either nest the logic that expects a title inside the if statement instead of returning early, or istanbul ignore the if statements that check the title (since they only return, I do not see it being a big deal to ignore them).
Also, the validation function for askTitle
is not covered by tests. I would maybe pull this function out of the askTitle
function and make it a new function that you can test separately. Alternatively, you could use a mock implementation of vscode.window.showInputBox
that calls the validation function.
Before: Move leaf node above or below Book/Subbook drop target After: Insert leaf node at the top of the Book/Subbook child list (index 0)
Ref: https://github.com/openstax/ce/issues/2223
Ref: https://github.com/openstax/ce/issues/1910
Ref: https://github.com/openstax/ce/issues/2230