Skip to content
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
1 change: 0 additions & 1 deletion app/javascript/packages/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "@18f/identity-assets",
"private": true,
"version": "1.0.0",
"main": "index.js",
"peerDependencies": {
"webpack": ">=5"
}
Expand Down
7 changes: 5 additions & 2 deletions app/javascript/packages/time-element/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@ describe('TimeElement', () => {
usePropertyValue(Intl.DateTimeFormat.prototype, 'formatToParts', undefined);

it('sets text using Intl.DateTimeFormat#format as fallback', () => {
const date = new Date(2020, 3, 21, 14, 3, 24);
const element = createElement({
format: '%{month} %{day}, %{year} at %{hour}:%{minute} %{day_period}',
timestamp: new Date(2020, 3, 21, 14, 3, 24).toISOString(),
timestamp: date.toISOString(),
});

expect(element.textContent).to.equal('April 21, 2020, 2:03 PM');
const expected = element.formatter.format(date);

expect(element.textContent).to.equal(expected);
});
});
});
6 changes: 6 additions & 0 deletions app/javascript/packages/time-element/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ export class TimeElement extends HTMLElement {
}
}
}

declare global {
interface HTMLElementTagNameMap {
'lg-time': TimeElement;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit non-obvious, but what this is doing is making it so that the createElement call in the spec will have the current inferred return type based on document.createElement so that the reference to element.formatter doesn't produce a type error.

Before After
image image

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ describe('document-capture/components/acuant-capture', () => {
const button = getByLabelText('Image');
await userEvent.click(button);

await waitFor(() => !container.querySelector('.full-screen'));
expect(document.activeElement).to.equal(outsideInput);
await waitFor(() => document.activeElement === outsideInput);
expect(container.classList.contains('full-screen')).to.be.false();
});

it('renders pending state while cropping', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ describe('document-capture/components/document-capture', () => {

submitButton = getByText('forms.buttons.submit.default');
await userEvent.click(submitButton);
const interstitialHeading = getByText('doc_auth.headings.interstitial');
expect(interstitialHeading).to.be.ok();

await findByText('doc_auth.errors.general.network_error');

Expand Down Expand Up @@ -290,8 +288,6 @@ describe('document-capture/components/document-capture', () => {
// Verify re-submission. It will fail again, but test can at least assure that the interstitial
// screen is shown once more.
await userEvent.click(submitButton);
const interstitialHeading = getByText('doc_auth.headings.interstitial');
expect(interstitialHeading).to.be.ok();

await waitFor(() => expect(() => getAllByText('doc_auth.info.interstitial_eta')).to.throw());

Expand Down
1 change: 1 addition & 0 deletions spec/javascripts/support/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const TEST_URL = 'http://example.test';
export function createDOM() {
const dom = new JSDOM('<!doctype html><html lang="en"><head><title>JSDOM</title></head></html>', {
url: TEST_URL,
pretendToBeVisual: true,
resources: new (class extends ResourceLoader {
/**
* @param {string} url
Expand Down