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

Standardise NodeProcessor.data.ts constant names #2483

Merged

Conversation

luminousleek
Copy link
Contributor

@luminousleek luminousleek commented Mar 29, 2024

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Partially addresses #2476
Overview of changes:

npm run test -- NodeProcessor.test.ts has been run and all tests pass.

Anything you'd like to highlight/discuss:

Testing instructions:

Proposed commit message: (wrap lines at 72 characters)

Standardise NodeProcessor constant names

Currently, there are two naming formats for constant names. This
has led to a redundant test being created in a previous PR.

Let's standardise the naming format to make the purpose of these
constants clearer. Let's also split some constants to test for one
overridden attribute at a time.


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

Reviewer checklist:

Indicate the SEMVER impact of the PR:

  • Major (when you make incompatible API changes)
  • Minor (when you add functionality in a backward compatible manner)
  • Patch (when you make backward compatible bug fixes)

At the end of the review, please label the PR with the appropriate label: r.Major, r.Minor, r.Patch.

Breaking change release note preparation (if applicable):

  • To be included in the release note for any feature that is made obsolete/breaking

Give a brief explanation note about:

  • what was the old feature that was made obsolete
  • any replacement feature (if any), and
  • how the author should modify his website to migrate from the old feature to the replacement feature (if possible).

Comment on lines 41 to 62
export const PROCESS_PANEL_HEADER_NO_OVERRIDE = `
<panel header="# Lorem ipsum" alt="**strong alt**">
<div slot="header">
This existing header slot should be preserved in favour over header attribute.
</div>
Header attribute should not be inserted under panel since there is both an alt attribute and header slot,
but should be deleted.
Alt attribute should be inserted under panel as slot.
</panel>
`;

export const PROCESS_PANEL_HEADER_NO_OVERRIDE_EXPECTED = `
<panel><template #_alt><p><strong>strong alt</strong></p>
</template>
<template #header><div>
This existing header slot should be preserved in favour over header attribute.
</div></template>
Header attribute should not be inserted under panel since there is both an alt attribute and header slot,
but should be deleted.
Alt attribute should be inserted under panel as slot.
</panel>
`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted this constant instead of the other one because this also tests for whether the alt attribute is processed correctly, which is tested for in the POST_PROCESS_PANEL_ID_ASSIGNED_USING_HEADER_SLOT test in lines 66 to 76

Copy link

codecov bot commented Mar 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.14%. Comparing base (66591c5) to head (7f6f663).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2483      +/-   ##
==========================================
+ Coverage   51.11%   51.14%   +0.03%     
==========================================
  Files         124      124              
  Lines        5355     5359       +4     
  Branches     1152     1152              
==========================================
+ Hits         2737     2741       +4     
  Misses       2328     2328              
  Partials      290      290              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@kaixin-hc kaixin-hc left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for starting on this! I have a couple of nits but besides that I think this is ready to merge

Alt attribute should be inserted under panel as slot.
</panel>
`;

// Post Process

export const POST_PROCESS_PANEL_ID_ASSIGNED_USING_HEADER_SLOT = `
Copy link
Contributor

Choose a reason for hiding this comment

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

Let me know if I'm missing something here, but it doesn't look like this one has an alt slot for it to test for it being inserted under panel as stated in your earlier comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:O You are right - I think I got confused by the text in the constant. Will delete the other constant then

export const PROCESS_QUESTION_ATTRIBUTES_NO_OVERRIDE = `
<question header="**header**" hint="**hint**" answer="**answer**">
export const PROCESS_QUESTION_HEADER_SLOT_TAKES_PRIORITY = `
<question header="**header**">
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Since this text is overridden - maybe you can change the overridden text to "lorum ipsum" or something like in the other tests? This was confusing to me because I didn't realise the difference between what was overridden for a while.

Similar for hint & answer below

Copy link
Contributor

@kaixin-hc kaixin-hc left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for your work : ))

Copy link
Contributor

@yucheng11122017 yucheng11122017 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for the excellent work as usual @luminousleek

@kaixin-hc kaixin-hc merged commit 69ec838 into MarkBind:master Apr 4, 2024
9 checks passed
Copy link

github-actions bot commented Apr 4, 2024

@kaixin-hc Each PR must have a SEMVER impact label, please remember to label the PR properly.

@yucheng11122017 yucheng11122017 added the r.Patch Version resolver: increment by 0.0.1 label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r.Patch Version resolver: increment by 0.0.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants