Skip to content

Commit

Permalink
Add fallback for non-standard doc statuses (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdaley authored Mar 7, 2024
1 parent fe2550e commit f2f41f5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion web/app/components/document/status-icon.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/>
{{/if}}

{{#if (or this.isDraft this.isInReview)}}
{{#if this.defaultStrokeIsShown}}
{{! page stroke }}
<path
data-test-default-page-stroke
Expand Down
15 changes: 15 additions & 0 deletions web/app/components/document/status-icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ export default class DocumentStatusIconComponent extends Component<DocumentStatu
protected get isObsolete() {
return this.args.status === "Obsolete";
}
/**
* Whether the default stroke is shown.
* True if the doc is a draft, in review, or in a non-standard state
*/
protected get defaultStrokeIsShown() {
if (
this.isDraft ||
this.isInReview ||
(!this.isApproved && !this.isObsolete)
) {
return true;
} else {
return false;
}
}
}

declare module "@glint/environment-ember-loose/registry" {
Expand Down
6 changes: 6 additions & 0 deletions web/tests/integration/components/document/status-icon-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,11 @@ module("Integration | Component | document/status-icon", function (hooks) {
assert
.dom(OBSOLETE_PAGE_STROKE)
.exists("the obsolete state has a custom page stroke");

status = "Non-Standard";
this.set("status", status);

assert.dom(DEFAULT_PAGE_FILL).exists();
assert.dom(DEFAULT_PAGE_STROKE).exists();
});
});

0 comments on commit f2f41f5

Please sign in to comment.