-
Notifications
You must be signed in to change notification settings - Fork 74
Pattern selection #792
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
Pattern selection #792
Changes from all commits
8144d28
f9a1aae
23ce6e0
300a77b
119f05f
e0641af
c169894
0753eae
f918afa
c560320
6a0aa10
6c8f89a
a9988e8
e967000
53c3a0e
4cf1e09
a94eb69
0a1c0ab
28d5e9d
0716cf6
4b15386
0df2919
b0cb432
f1f5ec8
0f67b43
2ac7a3f
6d8947c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Copyright (c) [2023] SUSE LLC | ||
| * | ||
| * All Rights Reserved. | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify it | ||
| * under the terms of version 2 of the GNU General Public License as published | ||
| * by the Free Software Foundation. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| * more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License along | ||
| * with this program; if not, contact SUSE LLC. | ||
| * | ||
| * To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| * find current contact information at www.suse.com. | ||
| */ | ||
|
|
||
| import React from "react"; | ||
| import { Section } from "~/components/core"; | ||
|
|
||
| /** | ||
| * Pattern group component | ||
| * @component | ||
| * @param {string} name name of the group | ||
| * @param {JSX.Element} children the wrapped content with the patterns belonging to this group | ||
| * @returns {JSX.Element} | ||
| */ | ||
| export default function PatternGroup({ name, children }) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NP: does it deserve its own component?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Originally it was much more complex because it was a collapsible/expandable section. But I'd probably still keep it separate as it is a self contained logical part. |
||
| return ( | ||
| <Section title={name}>{children}</Section> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright (c) [2023] SUSE LLC | ||
| * | ||
| * All Rights Reserved. | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify it | ||
| * under the terms of version 2 of the GNU General Public License as published | ||
| * by the Free Software Foundation. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| * more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License along | ||
| * with this program; if not, contact SUSE LLC. | ||
| * | ||
| * To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| * find current contact information at www.suse.com. | ||
| */ | ||
|
|
||
| import React from "react"; | ||
|
|
||
| import { screen } from "@testing-library/react"; | ||
| import { plainRender } from "~/test-utils"; | ||
|
|
||
| import PatternGroup from "./PatternGroup"; | ||
|
|
||
| describe("PatternGroup", () => { | ||
| const name = "Pattern name"; | ||
| const content = "Just a children content"; | ||
|
|
||
| it("displays the pattern name and the content", async () => { | ||
| plainRender(<PatternGroup name={name}>{content}</PatternGroup>); | ||
|
|
||
| // the name is displayed | ||
| screen.getByText(name); | ||
| // the content is displayed | ||
| screen.getByText(content); | ||
| }); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.