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

(#777) Badges and Labels added new pattern for truncating text #781

Merged
merged 5 commits into from
Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/clay-badge/src/ClayBadge.soy
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
{/let}

<span {$attributes}>
{$label}
<span class="text-truncate-inline">
<span class="text-truncate">{$label}</span>
</span>
</span>
{/template}
88 changes: 77 additions & 11 deletions packages/clay-badge/src/__tests__/__snapshots__/ClayBadge.js.snap
Original file line number Diff line number Diff line change
@@ -1,23 +1,89 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ClayBadge should render a \`danger color\` badge 1`] = `<span class="badge badge-danger">Foo</span>`;
exports[`ClayBadge should render a \`danger color\` badge 1`] = `
<span class="badge badge-danger">
<span class="text-truncate-inline">
<span class="text-truncate">Foo</span>
</span>
</span>
`;

exports[`ClayBadge should render a \`default color\` badge 1`] = `<span class="badge badge-primary">Foo</span>`;
exports[`ClayBadge should render a \`default color\` badge 1`] = `
<span class="badge badge-primary">
<span class="text-truncate-inline">
<span class="text-truncate">Foo</span>
</span>
</span>
`;

exports[`ClayBadge should render a \`info color\` badge 1`] = `<span class="badge badge-info">Foo</span>`;
exports[`ClayBadge should render a \`info color\` badge 1`] = `
<span class="badge badge-info">
<span class="text-truncate-inline">
<span class="text-truncate">Foo</span>
</span>
</span>
`;

exports[`ClayBadge should render a \`primary color\` badge 1`] = `<span class="badge badge-primary">Foo</span>`;
exports[`ClayBadge should render a \`primary color\` badge 1`] = `
<span class="badge badge-primary">
<span class="text-truncate-inline">
<span class="text-truncate">Foo</span>
</span>
</span>
`;

exports[`ClayBadge should render a \`secondary color\` badge 1`] = `<span class="badge badge-secondary">Foo</span>`;
exports[`ClayBadge should render a \`secondary color\` badge 1`] = `
<span class="badge badge-secondary">
<span class="text-truncate-inline">
<span class="text-truncate">Foo</span>
</span>
</span>
`;

exports[`ClayBadge should render a \`success color\` badge 1`] = `<span class="badge badge-success">Foo</span>`;
exports[`ClayBadge should render a \`success color\` badge 1`] = `
<span class="badge badge-success">
<span class="text-truncate-inline">
<span class="text-truncate">Foo</span>
</span>
</span>
`;

exports[`ClayBadge should render a \`warning color\` badge 1`] = `<span class="badge badge-warning">Foo</span>`;
exports[`ClayBadge should render a \`warning color\` badge 1`] = `
<span class="badge badge-warning">
<span class="text-truncate-inline">
<span class="text-truncate">Foo</span>
</span>
</span>
`;

exports[`ClayBadge should render a badge with classes 1`] = `<span class="badge badge-primary my-custom-class">Foo</span>`;
exports[`ClayBadge should render a badge with classes 1`] = `
<span class="badge badge-primary my-custom-class">
<span class="text-truncate-inline">
<span class="text-truncate">Foo</span>
</span>
</span>
`;

exports[`ClayBadge should render a badge with id 1`] = `<span class="badge badge-primary" id="myId">Foo</span>`;
exports[`ClayBadge should render a badge with id 1`] = `
<span class="badge badge-primary" id="myId">
<span class="text-truncate-inline">
<span class="text-truncate">Foo</span>
</span>
</span>
`;

exports[`ClayBadge should render a badge with label 1`] = `<span class="badge badge-primary">Bar</span>`;
exports[`ClayBadge should render a badge with label 1`] = `
<span class="badge badge-primary">
<span class="text-truncate-inline">
<span class="text-truncate">Bar</span>
</span>
</span>
`;

exports[`ClayBadge should render the default markup 1`] = `<span class="badge badge-primary">Foo</span>`;
exports[`ClayBadge should render the default markup 1`] = `
<span class="badge badge-primary">
<span class="text-truncate-inline">
<span class="text-truncate">Foo</span>
</span>
</span>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ exports[`ClayCardGrid should render the default markup 1`] = `
<a class=" card-title text-truncate" href="#">Hamburger</a>
<div class="card-subtitle text-truncate">U.S.A</div>
<div class="card-detail">
<span class="label label-success">No Spicy</span>
<span class="label label-success">
<span class="text-truncate-inline">
<span class="text-truncate">No Spicy</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -94,7 +98,11 @@ exports[`ClayCardGrid should render the default markup 1`] = `
<a class=" card-title text-truncate" href="#">Ramen</a>
<div class="card-subtitle text-truncate">China</div>
<div class="card-detail">
<span class="label label-warning">Spicy</span>
<span class="label label-warning">
<span class="text-truncate-inline">
<span class="text-truncate">Spicy</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -115,7 +123,11 @@ exports[`ClayCardGrid should render the default markup 1`] = `
<a class=" card-title text-truncate" href="#">Paella</a>
<div class="card-subtitle text-truncate">Spain</div>
<div class="card-detail">
<span class="label label-success">No Spicy</span>
<span class="label label-success">
<span class="text-truncate-inline">
<span class="text-truncate">No Spicy</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -141,7 +153,11 @@ exports[`ClayCardGrid should render the default markup 1`] = `
<a class=" card-title text-truncate" href="#">Pizza</a>
<div class="card-subtitle text-truncate">Italy</div>
<div class="card-detail">
<span class="label label-success">No Spicy</span>
<span class="label label-success">
<span class="text-truncate-inline">
<span class="text-truncate">No Spicy</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -162,7 +178,11 @@ exports[`ClayCardGrid should render the default markup 1`] = `
<a class=" card-title text-truncate" href="#">Carcamusas</a>
<div class="card-subtitle text-truncate">Toledo</div>
<div class="card-detail">
<span class="label label-warning">Spicy</span>
<span class="label label-warning">
<span class="text-truncate-inline">
<span class="text-truncate">Spicy</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -188,7 +208,11 @@ exports[`ClayCardGrid should render the default markup 1`] = `
<a class=" card-title text-truncate" href="#">Tacos</a>
<div class="card-subtitle text-truncate">Mexico</div>
<div class="card-detail">
<span class="label label-danger">Very Spicy</span>
<span class="label label-danger">
<span class="text-truncate-inline">
<span class="text-truncate">Very Spicy</span>
</span>
</span>
</div>
</div>
</div>
Expand Down
78 changes: 65 additions & 13 deletions packages/clay-card/src/__tests__/__snapshots__/ClayFileCard.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ exports[`ClayFileCard should render a ClayFileCard with labelStyle \`danger colo
<div class="autofit-col autofit-col-expand">
<div class="card-title text-truncate">My Title</div>
<div class="card-detail">
<span class="label label-danger">Approved</span>
<span class="label label-danger">
<span class="text-truncate-inline">
<span class="text-truncate">Approved</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -158,7 +162,11 @@ exports[`ClayFileCard should render a ClayFileCard with labelStyle \`info color\
<div class="autofit-col autofit-col-expand">
<div class="card-title text-truncate">My Title</div>
<div class="card-detail">
<span class="label label-info">Approved</span>
<span class="label label-info">
<span class="text-truncate-inline">
<span class="text-truncate">Approved</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -181,7 +189,11 @@ exports[`ClayFileCard should render a ClayFileCard with labelStyle \`secondary c
<div class="autofit-col autofit-col-expand">
<div class="card-title text-truncate">My Title</div>
<div class="card-detail">
<span class="label label-secondary">Approved</span>
<span class="label label-secondary">
<span class="text-truncate-inline">
<span class="text-truncate">Approved</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -204,7 +216,11 @@ exports[`ClayFileCard should render a ClayFileCard with labelStyle \`success col
<div class="autofit-col autofit-col-expand">
<div class="card-title text-truncate">My Title</div>
<div class="card-detail">
<span class="label label-success">Approved</span>
<span class="label label-success">
<span class="text-truncate-inline">
<span class="text-truncate">Approved</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -227,7 +243,11 @@ exports[`ClayFileCard should render a ClayFileCard with labelStyle \`warning col
<div class="autofit-col autofit-col-expand">
<div class="card-title text-truncate">My Title</div>
<div class="card-detail">
<span class="label label-warning">Approved</span>
<span class="label label-warning">
<span class="text-truncate-inline">
<span class="text-truncate">Approved</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -250,9 +270,21 @@ exports[`ClayFileCard should render a ClayFileCard with labels with styles mappe
<div class="autofit-col autofit-col-expand">
<div class="card-title text-truncate">My Title</div>
<div class="card-detail">
<span class="label label-success">Approved</span>
<span class="label label-warning">Pending</span>
<span class="label label-danger">Error</span>
<span class="label label-success">
<span class="text-truncate-inline">
<span class="text-truncate">Approved</span>
</span>
</span>
<span class="label label-warning">
<span class="text-truncate-inline">
<span class="text-truncate">Pending</span>
</span>
</span>
<span class="label label-danger">
<span class="text-truncate-inline">
<span class="text-truncate">Error</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -275,7 +307,11 @@ exports[`ClayFileCard should render a ClayFileCard with one label 1`] = `
<div class="autofit-col autofit-col-expand">
<div class="card-title text-truncate">My Title</div>
<div class="card-detail">
<span class="label label-secondary">Approved</span>
<span class="label label-secondary">
<span class="text-truncate-inline">
<span class="text-truncate">Approved</span>
</span>
</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -572,8 +608,16 @@ exports[`ClayFileCard should render a ClayFileCard with two labels 1`] = `
<div class="autofit-col autofit-col-expand">
<div class="card-title text-truncate">My Title</div>
<div class="card-detail">
<span class="label label-secondary">Approved</span>
<span class="label label-secondary">Pending</span>
<span class="label label-secondary">
<span class="text-truncate-inline">
<span class="text-truncate">Approved</span>
</span>
</span>
<span class="label label-secondary">
<span class="text-truncate-inline">
<span class="text-truncate">Pending</span>
</span>
</span>
</div>
</div>
</div>
Expand All @@ -596,8 +640,16 @@ exports[`ClayFileCard should render a ClayFileCard with two labels with styles 1
<div class="autofit-col autofit-col-expand">
<div class="card-title text-truncate">My Title</div>
<div class="card-detail">
<span class="label label-warning">Approved</span>
<span class="label label-danger">Pending</span>
<span class="label label-warning">
<span class="text-truncate-inline">
<span class="text-truncate">Approved</span>
</span>
</span>
<span class="label label-danger">
<span class="text-truncate-inline">
<span class="text-truncate">Pending</span>
</span>
</span>
</div>
</div>
</div>
Expand Down
Loading