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

chore: convert more tests to TS #903

Merged
merged 9 commits into from
Nov 20, 2023
Merged

Conversation

pauldambra
Copy link
Member

:I've started so I'll finish:.meme

Keep converting tests to TypeScript.

Copy link

github-actions bot commented Nov 19, 2023

Size Change: 0 B

Total Size: 739 kB

ℹ️ View Unchanged
Filename Size
dist/array.full.js 175 kB
dist/array.js 117 kB
dist/es.js 117 kB
dist/exception-autocapture.js 12 kB
dist/module.js 117 kB
dist/recorder-v2.js 104 kB
dist/recorder.js 58.4 kB
dist/surveys.js 39.9 kB

compressed-size-action

@@ -42,11 +100,11 @@ describe('Autocapture system', () => {
sensitiveInput.value = 'test val'
sensitiveInput.className = 'ph-sensitive'

hidden = document.createElement('div')
hidden = document.createElement('input')
Copy link
Member Author

Choose a reason for hiding this comment

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

JS didn't care that we were hammering input props into a div

hidden.setAttribute('type', 'hidden')
hidden.value = 'hidden val'

password = document.createElement('div')
password = document.createElement('input')
Copy link
Member Author

Choose a reason for hiding this comment

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

JS didn't care that we were hammering input props into a div

@@ -160,12 +224,12 @@ describe('Autocapture system', () => {
sensitiveInput.setAttribute('data-ph-capture-attribute-on-the-sensitive-input', 'is on the sensitive-input')
sensitiveInput.className = 'ph-sensitive'

hidden = document.createElement('div')
hidden = document.createElement('input')
Copy link
Member Author

Choose a reason for hiding this comment

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

JS didn't care that we were hammering input props into a div

hidden.setAttribute('type', 'hidden')
hidden.setAttribute('data-ph-capture-attribute-on-the-hidden', 'is on the hidden')
hidden.value = 'hidden val'

password = document.createElement('div')
password = document.createElement('input')
Copy link
Member Author

Choose a reason for hiding this comment

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

JS didn't care that we were hammering input props into a div

Comment on lines +269 to 279
it('should not collect augment from the hidden element value', () => {
const props = autocapture._getAugmentPropertiesFromElement(hidden)
expect(props['on-the-hidden']).toBe('is on the hidden')
expect(props).toStrictEqual({})
})

it('should collect augment from the password element value', () => {
const props = autocapture._getAugmentPropertiesFromElement(password)
expect(props['on-the-password']).toBe('is on the password')
expect(props).toStrictEqual({})
})
})

Copy link
Member Author

Choose a reason for hiding this comment

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

These tests were wrong because we were setting input properties on a div, we shouldn't be capturing anything on hidden and password inputs. It behaves correctly, just the tests were confused

@pauldambra pauldambra requested a review from a team November 19, 2023 21:12
@pauldambra pauldambra merged commit 8ed9d0a into master Nov 20, 2023
13 checks passed
@pauldambra pauldambra deleted the chore/convert-more-tests-tots branch November 20, 2023 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants