-
Notifications
You must be signed in to change notification settings - Fork 127
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
Conversation
Size Change: 0 B Total Size: 739 kB ℹ️ View Unchanged
|
@@ -42,11 +100,11 @@ describe('Autocapture system', () => { | |||
sensitiveInput.value = 'test val' | |||
sensitiveInput.className = 'ph-sensitive' | |||
|
|||
hidden = document.createElement('div') | |||
hidden = document.createElement('input') |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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
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({}) | ||
}) | ||
}) | ||
|
There was a problem hiding this comment.
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
:I've started so I'll finish:.meme
Keep converting tests to TypeScript.