Skip to content

Commit

Permalink
add test for long titles
Browse files Browse the repository at this point in the history
  • Loading branch information
deandre committed Jun 6, 2024
1 parent 5c7d561 commit 74d1108
Show file tree
Hide file tree
Showing 19 changed files with 160 additions and 153 deletions.
5 changes: 5 additions & 0 deletions chromatic.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"onlyChanged": true,
"projectId": "Project:66611647ec86d1e0b3e003b0",
"zip": true
}
19 changes: 2 additions & 17 deletions src/components/Task.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import PropTypes from "prop-types";

export default function Task({
task: { id, title, state },
onArchiveTask,
Expand Down Expand Up @@ -30,8 +28,10 @@ export default function Task({
name="title"
id={`title-${id}`}
placeholder="Input title"
style={{ textOverflow: "ellipsis" }}
/>
</label>

{state !== "TASK_ARCHIVED" && (
<button
className="pin-button"
Expand All @@ -46,18 +46,3 @@ export default function Task({
</div>
);
}
Task.propTypes = {
/** Composition of the task */
task: PropTypes.shape({
/** Id of the task */
id: PropTypes.string.isRequired,
/** Title of the task */
title: PropTypes.string.isRequired,
/** Current state of the task */
state: PropTypes.string.isRequired,
}),
/** Event to change the task to archived */
onArchiveTask: PropTypes.func,
/** Event to change the task to pinned */
onPinTask: PropTypes.func,
};
11 changes: 11 additions & 0 deletions src/components/Task.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,14 @@ export const Archived = {
},
},
};

const longTitleString = `This task's name is absurdly large. In fact, I think if I keep going I might end up with content overflow. What will happen? The star that represents a pinned task could have text overlapping. The text could cut-off abruptly when it reaches the star. I hope not!`;

export const LongTitle = {
args: {
task: {
...Default.args.task,
title: longTitleString,
},
},
};

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions storybook-static/assets/iframe-45589ae1.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion storybook-static/assets/iframe-fff44ea6.js

This file was deleted.

1 change: 0 additions & 1 deletion storybook-static/assets/index-4ded3345.js

This file was deleted.

Loading

0 comments on commit 74d1108

Please sign in to comment.