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

[BD-46] feat: add testing guidelines #1165

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

monteri
Copy link
Contributor

@monteri monteri commented Mar 24, 2022

New features:

  • component TestingGuideline that corresponds to the <guide /> tag in the .md files
  • add converting strings from .md file when passing props to the <guide /> tag using markdown-to-jsx
  • according to the PAR-728 filled Testing guidelines for all page components (except deprecated)

JIRA: PAR-729

@netlify
Copy link

netlify bot commented Mar 24, 2022

Deploy Preview for paragon-openedx ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 28551e5
🔍 Latest deploy log https://app.netlify.com/sites/paragon-openedx/deploys/6297337653d0fd00091c472f
😎 Deploy Preview https://deploy-preview-1165--paragon-openedx.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@openedx-webhooks
Copy link

Thanks for the pull request, @monteri! I've created BLENDED-1160 to keep track of it in Jira. More details are on the BD-46 project page.

When this pull request is ready, tag your edX technical lead.

@openedx-webhooks openedx-webhooks added blended PR is managed through 2U's blended developmnt program needs triage labels Mar 24, 2022
@codecov
Copy link

codecov bot commented Mar 24, 2022

Codecov Report

Merging #1165 (1aba536) into master (b5eb9a9) will decrease coverage by 0.12%.
The diff coverage is n/a.

❗ Current head 1aba536 differs from pull request most recent head 28551e5. Consider uploading reports for the commit 28551e5 to get more accurate results

@@            Coverage Diff             @@
##           master    #1165      +/-   ##
==========================================
- Coverage   91.02%   90.90%   -0.13%     
==========================================
  Files         196      195       -1     
  Lines        3243     3155      -88     
  Branches      732      704      -28     
==========================================
- Hits         2952     2868      -84     
+ Misses        278      274       -4     
  Partials       13       13              
Impacted Files Coverage Δ
src/ProductTour/index.jsx 83.87% <0.00%> (-4.66%) ⬇️
src/SelectableBox/index.jsx 96.42% <0.00%> (-0.24%) ⬇️
src/Tabs/index.jsx 93.33% <0.00%> (-0.22%) ⬇️
src/Sticky/index.jsx 95.83% <0.00%> (-0.17%) ⬇️
src/DataTable/index.jsx 94.82% <0.00%> (ø)
src/Menu/SelectMenu.jsx 64.06% <0.00%> (ø)
src/Breadcrumb/index.jsx 100.00% <0.00%> (ø)
src/utils/breakpoints.js 100.00% <0.00%> (ø)
src/DataTable/DataViewToggle.jsx 100.00% <0.00%> (ø)
src/DataTable/utils/getVisibleColumns.jsx 100.00% <0.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5eb9a9...28551e5. Read the comment docs.

Comment on lines 95 to 99
<guide
defaultText="`nextLabel: 'Next'`, `prevLabel: 'Previous'`"
events="`onSelect`, `onSlid`, `onSlide`"
selectors="`carousel`"
/>
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this might be copy/pasta from Carousel above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, thank you, forgot to remove

Comment on lines 37 to 41
<guide
defaultText="`nextLabel: 'Next'`, `prevLabel: 'Previous'`"
events="`onSelect`, `onSlid`, `onSlide`"
selectors="`carousel`"
/>
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this might be copy/paste from Carousel above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, thank you, forgot to remove

@@ -46,4 +46,4 @@ notes: |
<Image src="https://source.unsplash.com/1600x800/?nature,flower" fluid />
```


<guide />
Copy link
Member

Choose a reason for hiding this comment

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

I think dataTestId is supported here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, thank you, added

@@ -30,3 +30,7 @@ notes: |
</Figure.Caption>
</Figure>
```

<guide
selectors="`figure`"
Copy link
Member

Choose a reason for hiding this comment

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

I think dataTestId is supported here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it is supported, my mistake. Added

@@ -91,3 +91,9 @@ class CheckBoxWrapper extends React.Component {
}
}
```

<guide
Copy link
Member

Choose a reason for hiding this comment

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

I think dataTestId is supported here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, but as it is deprecated, I remove testguide from there

@@ -14,3 +14,4 @@ body {
@import "../components/doc-elements";
@import "../components/Settings";
@import "../components/Toc";
@import "../components/TestingGuideline";
Copy link
Member

Choose a reason for hiding this comment

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

nit: newline

@@ -35,17 +42,28 @@ export default function PageTemplate({
h6: (props) => <LinkedHeading h="6" {...props} />,
pre: props => <div {...props} />,
code: CodeBlock,
guide: (props) => (
Copy link
Member

Choose a reason for hiding this comment

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

Might be kind of a pain to change everywhere, but I'm thinking testguide might be a bit clearer to make it more explicit it has to do with the testing guidelines? What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it is more appropriate so I change

selectors,
}) => {
const [collapseIsOpen, setCollapseIsOpen] = useState(false);
setIsGuidelinesOnPage(true);
Copy link
Member

Choose a reason for hiding this comment

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

[clarification] Is it OK this happens on every component re-render? Or should it be in a useEffect with an empty dependency array?

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 think the idea of having useEffect is better than simple function call. But as I read about setting state to the same value does nothing. Correct me if it is not right. But according to every render function call, yes, useEffect is better here

@@ -0,0 +1,5 @@
.pgn-doc__guideline {
code {
background: #f8f8ff;
Copy link
Member

Choose a reason for hiding this comment

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

Is there an SCSS color variable we could use here?

Copy link
Contributor Author

@monteri monteri Mar 25, 2022

Choose a reason for hiding this comment

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

yes, I added $danger-100. It is similar to that color

@@ -1,4 +1,4 @@
import React from 'react';
import React, {useState} from 'react';
Copy link
Member

Choose a reason for hiding this comment

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

nit: { useState }

@monteri monteri force-pushed the zadorozhnii/docs-testing-guidelines branch from a7bc1ff to d345511 Compare March 25, 2022 13:09
@monteri monteri force-pushed the zadorozhnii/docs-testing-guidelines branch from 9cc5f74 to 1aba536 Compare May 11, 2022 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blended PR is managed through 2U's blended developmnt program engineering Engineering needs triage
Projects
Status: In review
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

4 participants