@gogitcms/design-system 0.16.0-next.1 → 0.16.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gogitcms/design-system",
|
|
3
|
-
"version": "0.16.0-next.
|
|
3
|
+
"version": "0.16.0-next.2",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"types": "src/index.ts",
|
|
6
6
|
"// exports": "The root entry is the react-native source the SPAs, desktop app and mobile app consume. ./web is the plain-DOM build for server-rendered surfaces (the Astro docs site) that don't run react-native-web, and ./css ships the tokens as custom properties. The trailing wildcard keeps deep paths resolvable — plugin bundling and the Vite aliases reach into src/ directly.",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { render, screen, fireEvent } from "@testing-library/react";
|
|
2
|
+
import { render, screen, fireEvent, within } from "@testing-library/react";
|
|
3
3
|
import { ThemeProvider } from "../ThemeProvider";
|
|
4
4
|
import { ContentBrowser, type CmsEntry, type CmsNavSection } from "../components/ContentBrowser";
|
|
5
5
|
import { FORMS_NAV_KEY, formsNavKey, type FormInfo, type FormsApi } from "../forms";
|
|
@@ -109,3 +109,49 @@ test("an open form takes the whole content area", async () => {
|
|
|
109
109
|
expect(screen.queryByTestId("forms-empty")).not.toBeInTheDocument();
|
|
110
110
|
expect(screen.queryByTestId("resize-forms")).not.toBeInTheDocument();
|
|
111
111
|
});
|
|
112
|
+
|
|
113
|
+
// Media, Forms and Changes head their content pane with PaneTitle; a collection
|
|
114
|
+
// heads the same pane with its own header. They have to be the same heading, or
|
|
115
|
+
// the title moves and changes size as you switch between them.
|
|
116
|
+
test("the forms heading matches a collection's, not a smaller indented one", () => {
|
|
117
|
+
const { unmount } = render(
|
|
118
|
+
wrap(
|
|
119
|
+
<ContentBrowser
|
|
120
|
+
workspace={{ name: "acme/site", initials: "AC", branch: "main", changed: 0 }}
|
|
121
|
+
sections={sections}
|
|
122
|
+
activeNavKey={FORMS_NAV_KEY}
|
|
123
|
+
onSelectNav={() => {}}
|
|
124
|
+
entries={entries}
|
|
125
|
+
userInitials="ED"
|
|
126
|
+
forms={makeApi()}
|
|
127
|
+
/>,
|
|
128
|
+
),
|
|
129
|
+
);
|
|
130
|
+
// Scoped to the pane: "Forms" is also the nav item that got us here.
|
|
131
|
+
const formsHeading = within(screen.getByTestId("pane-forms")).getByText("Forms");
|
|
132
|
+
// The heading sits directly in Pane's header row — the row with the pane's
|
|
133
|
+
// height and the rule under it. A padded wrapper of its own in between is
|
|
134
|
+
// what used to push this title a step right of every collection's.
|
|
135
|
+
expect(formsHeading.parentElement).toHaveStyle({ height: "48px", paddingLeft: "16px" });
|
|
136
|
+
const formsStyle = window.getComputedStyle(formsHeading);
|
|
137
|
+
unmount();
|
|
138
|
+
|
|
139
|
+
render(
|
|
140
|
+
wrap(
|
|
141
|
+
<ContentBrowser
|
|
142
|
+
workspace={{ name: "acme/site", initials: "AC", branch: "main", changed: 0 }}
|
|
143
|
+
sections={sections}
|
|
144
|
+
activeNavKey="posts"
|
|
145
|
+
onSelectNav={() => {}}
|
|
146
|
+
entries={entries}
|
|
147
|
+
userInitials="ED"
|
|
148
|
+
/>,
|
|
149
|
+
),
|
|
150
|
+
);
|
|
151
|
+
const collectionHeading = within(screen.getByTestId("pane-entries")).getByText("Posts");
|
|
152
|
+
const collectionStyle = window.getComputedStyle(collectionHeading);
|
|
153
|
+
|
|
154
|
+
expect(formsStyle.fontSize).toBe(collectionStyle.fontSize);
|
|
155
|
+
expect(formsStyle.fontWeight).toBe(collectionStyle.fontWeight);
|
|
156
|
+
expect(formsStyle.flexGrow).toBe(collectionStyle.flexGrow);
|
|
157
|
+
});
|
|
@@ -5082,14 +5082,20 @@ function mediaSetLabel(sets: MediaSetInfo[], name: string): string {
|
|
|
5082
5082
|
return set ? titleCaseWord(set.name) : titleCaseWord(name);
|
|
5083
5083
|
}
|
|
5084
5084
|
|
|
5085
|
-
// PaneTitle is the content pane's heading
|
|
5086
|
-
//
|
|
5085
|
+
// PaneTitle is the content pane's heading for the surfaces with no controls
|
|
5086
|
+
// beside it — Changes, Media, Forms.
|
|
5087
|
+
//
|
|
5088
|
+
// Deliberately the same Text the collection header uses (`listHeader`), and
|
|
5089
|
+
// nothing else. Pane's header row already supplies the height, the horizontal
|
|
5090
|
+
// padding and the rule beneath, so the padded wrapper this used to add sat
|
|
5091
|
+
// inside that padding and pushed the title a step right of every collection's —
|
|
5092
|
+
// at `body` rather than `h3`, so it read a size smaller too. Switching between
|
|
5093
|
+
// Posts and Media moved the heading twice over.
|
|
5087
5094
|
function PaneTitle({ title }: { title: string }) {
|
|
5088
|
-
const t = useTheme();
|
|
5089
5095
|
return (
|
|
5090
|
-
<
|
|
5091
|
-
|
|
5092
|
-
</
|
|
5096
|
+
<Text variant="h3" weight="semibold" style={{ flex: 1 }}>
|
|
5097
|
+
{title}
|
|
5098
|
+
</Text>
|
|
5093
5099
|
);
|
|
5094
5100
|
}
|
|
5095
5101
|
|