@instructure/ui-dom-utils 10.19.2-snapshot-2 → 10.19.2-snapshot-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/package.json +4 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/es/__new-tests__/addEventListener.test.js +0 -43
- package/es/__new-tests__/addInputModeListener.test.js +0 -58
- package/es/__new-tests__/addPositionChangeListener.test.js +0 -65
- package/es/__new-tests__/findTabbable.test.js +0 -79
- package/es/__new-tests__/getClassList.test.js +0 -47
- package/es/__new-tests__/getFontSize.test.js +0 -41
- package/es/__new-tests__/getOffsetParents.test.js +0 -124
- package/es/__new-tests__/getScrollParents.test.js +0 -96
- package/es/__new-tests__/isCustomElement.test.js +0 -41
- package/es/__new-tests__/isVisible.test.js +0 -126
- package/es/__new-tests__/requestAnimationFrame.test.js +0 -37
- package/es/__new-tests__/transformSelection.test.js +0 -67
- package/lib/__new-tests__/addEventListener.test.js +0 -44
- package/lib/__new-tests__/addInputModeListener.test.js +0 -59
- package/lib/__new-tests__/addPositionChangeListener.test.js +0 -66
- package/lib/__new-tests__/findTabbable.test.js +0 -80
- package/lib/__new-tests__/getClassList.test.js +0 -48
- package/lib/__new-tests__/getFontSize.test.js +0 -43
- package/lib/__new-tests__/getOffsetParents.test.js +0 -125
- package/lib/__new-tests__/getScrollParents.test.js +0 -97
- package/lib/__new-tests__/isCustomElement.test.js +0 -43
- package/lib/__new-tests__/isVisible.test.js +0 -127
- package/lib/__new-tests__/requestAnimationFrame.test.js +0 -39
- package/lib/__new-tests__/transformSelection.test.js +0 -69
- package/src/__new-tests__/addEventListener.test.tsx +0 -46
- package/src/__new-tests__/addInputModeListener.test.tsx +0 -60
- package/src/__new-tests__/addPositionChangeListener.test.tsx +0 -65
- package/src/__new-tests__/findTabbable.test.tsx +0 -68
- package/src/__new-tests__/getClassList.test.tsx +0 -46
- package/src/__new-tests__/getFontSize.test.tsx +0 -36
- package/src/__new-tests__/getOffsetParents.test.tsx +0 -98
- package/src/__new-tests__/getScrollParents.test.tsx +0 -83
- package/src/__new-tests__/isCustomElement.test.tsx +0 -45
- package/src/__new-tests__/isVisible.test.tsx +0 -113
- package/src/__new-tests__/requestAnimationFrame.test.tsx +0 -39
- package/src/__new-tests__/transformSelection.test.tsx +0 -80
- package/types/__new-tests__/addEventListener.test.d.ts +0 -2
- package/types/__new-tests__/addEventListener.test.d.ts.map +0 -1
- package/types/__new-tests__/addInputModeListener.test.d.ts +0 -2
- package/types/__new-tests__/addInputModeListener.test.d.ts.map +0 -1
- package/types/__new-tests__/addPositionChangeListener.test.d.ts +0 -2
- package/types/__new-tests__/addPositionChangeListener.test.d.ts.map +0 -1
- package/types/__new-tests__/findTabbable.test.d.ts +0 -2
- package/types/__new-tests__/findTabbable.test.d.ts.map +0 -1
- package/types/__new-tests__/getClassList.test.d.ts +0 -2
- package/types/__new-tests__/getClassList.test.d.ts.map +0 -1
- package/types/__new-tests__/getFontSize.test.d.ts +0 -2
- package/types/__new-tests__/getFontSize.test.d.ts.map +0 -1
- package/types/__new-tests__/getOffsetParents.test.d.ts +0 -2
- package/types/__new-tests__/getOffsetParents.test.d.ts.map +0 -1
- package/types/__new-tests__/getScrollParents.test.d.ts +0 -2
- package/types/__new-tests__/getScrollParents.test.d.ts.map +0 -1
- package/types/__new-tests__/isCustomElement.test.d.ts +0 -2
- package/types/__new-tests__/isCustomElement.test.d.ts.map +0 -1
- package/types/__new-tests__/isVisible.test.d.ts +0 -2
- package/types/__new-tests__/isVisible.test.d.ts.map +0 -1
- package/types/__new-tests__/requestAnimationFrame.test.d.ts +0 -2
- package/types/__new-tests__/requestAnimationFrame.test.d.ts.map +0 -1
- package/types/__new-tests__/transformSelection.test.d.ts +0 -2
- package/types/__new-tests__/transformSelection.test.d.ts.map +0 -1
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import { render } from '@testing-library/react'
|
|
26
|
-
import '@testing-library/jest-dom'
|
|
27
|
-
import { getOffsetParents } from '../getOffsetParents'
|
|
28
|
-
|
|
29
|
-
describe('getOffsetParents', () => {
|
|
30
|
-
// At rendering, we receive the node_wrapper and the body as extra offsetParents
|
|
31
|
-
const node = (
|
|
32
|
-
<div data-testid="node">
|
|
33
|
-
<div
|
|
34
|
-
data-testid="child_1_wrapper_parent"
|
|
35
|
-
style={{ transform: '200px', position: 'relative' }}
|
|
36
|
-
>
|
|
37
|
-
<div data-testid="child_1_wrapper">
|
|
38
|
-
<div data-testid="child-1" style={{ height: '500px' }}>
|
|
39
|
-
Test
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
|
|
44
|
-
<div
|
|
45
|
-
data-testid="child_2_wrapper_parent"
|
|
46
|
-
style={{ transform: '200px', position: 'absolute' }}
|
|
47
|
-
>
|
|
48
|
-
<div data-testid="child_2_wrapper" style={{ position: 'absolute' }}>
|
|
49
|
-
<div data-testid="child-2">Test</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<div data-testid="child_3_wrapper">
|
|
54
|
-
<div data-testid="child-3">Test</div>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
it('should find offset parent for inline elements', () => {
|
|
60
|
-
const { getByTestId } = render(node)
|
|
61
|
-
const child = getByTestId('child-1')
|
|
62
|
-
const parent = getByTestId('child_1_wrapper_parent')
|
|
63
|
-
const offsetParents = getOffsetParents(child)
|
|
64
|
-
|
|
65
|
-
expect(offsetParents[1]).toBe(parent)
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
it('should ignore static parents when absolute', () => {
|
|
69
|
-
const { getByTestId } = render(node)
|
|
70
|
-
const child = getByTestId('child-2')
|
|
71
|
-
const offsetParents = getOffsetParents(child)
|
|
72
|
-
|
|
73
|
-
expect(offsetParents.length).toBe(5)
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
it('should handle fixed', () => {
|
|
77
|
-
const { getByTestId } = render(node)
|
|
78
|
-
const child = getByTestId('child-3')
|
|
79
|
-
const offsetParents = getOffsetParents(child)
|
|
80
|
-
|
|
81
|
-
expect(offsetParents.length).toBe(4)
|
|
82
|
-
})
|
|
83
|
-
})
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import '@testing-library/jest-dom'
|
|
26
|
-
import { isDefinedCustomElement } from '../isDefinedCustomElement'
|
|
27
|
-
|
|
28
|
-
class TestElement extends HTMLElement {}
|
|
29
|
-
|
|
30
|
-
describe('isDefinedCustomElement', () => {
|
|
31
|
-
beforeAll(() => {
|
|
32
|
-
customElements.define('test-element', TestElement)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
it('should return true for defined elements', () => {
|
|
36
|
-
const el = document.createElement('test-element')
|
|
37
|
-
expect(isDefinedCustomElement(el)).toBe(true)
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('should return false for not defined elements', () => {
|
|
41
|
-
// it is possible to create a custom element that is not defined
|
|
42
|
-
const el = document.createElement('my-element')
|
|
43
|
-
expect(isDefinedCustomElement(el)).toBe(false)
|
|
44
|
-
})
|
|
45
|
-
})
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import { render, screen } from '@testing-library/react'
|
|
26
|
-
import '@testing-library/jest-dom'
|
|
27
|
-
import { isVisible } from '../isVisible'
|
|
28
|
-
|
|
29
|
-
describe('isVisible', () => {
|
|
30
|
-
it('should recognize visible elements', () => {
|
|
31
|
-
render(<div data-testid="test">Hello world!</div>)
|
|
32
|
-
const element = screen.getByTestId('test')
|
|
33
|
-
|
|
34
|
-
expect(isVisible(element)).toBe(true)
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('should recognize elements with display: none', () => {
|
|
38
|
-
render(
|
|
39
|
-
<div data-testid="test">
|
|
40
|
-
<span style={{ display: 'none' }}>Hello world!</span>
|
|
41
|
-
</div>
|
|
42
|
-
)
|
|
43
|
-
const element = screen.getByTestId('test').firstChild
|
|
44
|
-
|
|
45
|
-
expect(isVisible(element)).toBe(false)
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
it('should recognize elements hidden with clip', () => {
|
|
49
|
-
const style: React.CSSProperties = {
|
|
50
|
-
position: 'absolute',
|
|
51
|
-
overflow: 'hidden',
|
|
52
|
-
clip: 'rect(0,0,0,0)'
|
|
53
|
-
}
|
|
54
|
-
render(
|
|
55
|
-
<div data-testid="test">
|
|
56
|
-
<span style={style}>Hello world!</span>
|
|
57
|
-
</div>
|
|
58
|
-
)
|
|
59
|
-
const element = screen.getByTestId('test').firstChild
|
|
60
|
-
|
|
61
|
-
expect(isVisible(element)).toBe(false)
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
it('should recognize clipped elements that are not hidden', () => {
|
|
65
|
-
const style: React.CSSProperties = {
|
|
66
|
-
position: 'absolute',
|
|
67
|
-
overflow: 'hidden',
|
|
68
|
-
clip: 'rect(0,0,10px,0)'
|
|
69
|
-
}
|
|
70
|
-
render(
|
|
71
|
-
<div data-testid="test">
|
|
72
|
-
<span style={style}>Hello world!</span>
|
|
73
|
-
</div>
|
|
74
|
-
)
|
|
75
|
-
const element = screen.getByTestId('test').firstChild
|
|
76
|
-
|
|
77
|
-
expect(isVisible(element)).toBe(true)
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
it('should recursively check parent visibility', () => {
|
|
81
|
-
const style: React.CSSProperties = { visibility: 'hidden' }
|
|
82
|
-
render(
|
|
83
|
-
<div data-testid="test" style={style}>
|
|
84
|
-
<span>
|
|
85
|
-
<span data-testid="test-2" style={{ visibility: 'visible' }}>
|
|
86
|
-
Hello world!
|
|
87
|
-
</span>
|
|
88
|
-
</span>
|
|
89
|
-
</div>
|
|
90
|
-
)
|
|
91
|
-
const element = screen.getByTestId('test-2')
|
|
92
|
-
|
|
93
|
-
expect(isVisible(element, false)).toBe(true)
|
|
94
|
-
expect(isVisible(element)).toBe(false)
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
it('should not recursively check text nodes', () => {
|
|
98
|
-
const style: React.CSSProperties = { visibility: 'hidden' }
|
|
99
|
-
render(
|
|
100
|
-
<div data-testid="test" style={style}>
|
|
101
|
-
<span>
|
|
102
|
-
<span data-testid="test-2" style={{ visibility: 'visible' }}>
|
|
103
|
-
Hello world!
|
|
104
|
-
</span>
|
|
105
|
-
</span>
|
|
106
|
-
</div>
|
|
107
|
-
)
|
|
108
|
-
const element = screen.getByTestId('test-2').firstChild
|
|
109
|
-
|
|
110
|
-
expect(isVisible(element, false)).toBe(true)
|
|
111
|
-
expect(isVisible(element)).toBe(false)
|
|
112
|
-
})
|
|
113
|
-
})
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import { waitFor } from '@testing-library/react'
|
|
26
|
-
import { vi } from 'vitest'
|
|
27
|
-
import { requestAnimationFrame } from '../requestAnimationFrame'
|
|
28
|
-
|
|
29
|
-
describe('requestAnimationFrame', () => {
|
|
30
|
-
it('should provide a cancel method', async () => {
|
|
31
|
-
const callback = vi.fn()
|
|
32
|
-
const raf = requestAnimationFrame(callback)
|
|
33
|
-
|
|
34
|
-
await waitFor(() => {
|
|
35
|
-
expect(callback).toHaveBeenCalledTimes(1)
|
|
36
|
-
expect(typeof raf.cancel).toBe('function')
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
})
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import { transformSelection, transformCursor } from '../transformSelection'
|
|
26
|
-
|
|
27
|
-
describe('transformSelection', () => {
|
|
28
|
-
it('should work with transformCursor', () => {
|
|
29
|
-
const paramObj = {
|
|
30
|
-
selectionStart: 2,
|
|
31
|
-
selectionEnd: 3,
|
|
32
|
-
selectionDirection: 'none',
|
|
33
|
-
value: '1x2345'
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const result = transformSelection(paramObj as HTMLTextAreaElement, '12345')
|
|
37
|
-
|
|
38
|
-
expect(result).toEqual({
|
|
39
|
-
selectionStart: 1,
|
|
40
|
-
selectionEnd: 2,
|
|
41
|
-
selectionDirection: 'none'
|
|
42
|
-
})
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
describe('transformCursor', () => {
|
|
47
|
-
it('should retain cursor at the end', () => {
|
|
48
|
-
const dirtyValue = '12_xxxx_'
|
|
49
|
-
const cleanedValue = '12'
|
|
50
|
-
const cursorIndex = dirtyValue.length
|
|
51
|
-
|
|
52
|
-
expect(transformCursor(cursorIndex, dirtyValue, cleanedValue)).toBe(
|
|
53
|
-
cleanedValue.length
|
|
54
|
-
)
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('should retain cursor at the start', () => {
|
|
58
|
-
const dirtyValue = '12_xxxx_67'
|
|
59
|
-
const cleanedValue = '1267'
|
|
60
|
-
const cursorIndex = 0
|
|
61
|
-
|
|
62
|
-
expect(transformCursor(cursorIndex, dirtyValue, cleanedValue)).toBe(0)
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
it('should retain cursor between cleaned values', () => {
|
|
66
|
-
const dirtyValue = '12_xxxx_67'
|
|
67
|
-
const cleanedValue = '1267'
|
|
68
|
-
const cursorIndex = 6
|
|
69
|
-
|
|
70
|
-
expect(transformCursor(cursorIndex, dirtyValue, cleanedValue)).toBe(2)
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('should retain cursor after cleaned values', () => {
|
|
74
|
-
const dirtyValue = '12_xxxx_67'
|
|
75
|
-
const cleanedValue = '1267'
|
|
76
|
-
const cursorIndex = dirtyValue.length - 1
|
|
77
|
-
|
|
78
|
-
expect(transformCursor(cursorIndex, dirtyValue, cleanedValue)).toBe(3)
|
|
79
|
-
})
|
|
80
|
-
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addEventListener.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/addEventListener.test.tsx"],"names":[],"mappings":"AA0BA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addInputModeListener.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/addInputModeListener.test.tsx"],"names":[],"mappings":"AA0BA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addPositionChangeListener.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/addPositionChangeListener.test.tsx"],"names":[],"mappings":"AA0BA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findTabbable.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/findTabbable.test.tsx"],"names":[],"mappings":"AAyBA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getClassList.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/getClassList.test.tsx"],"names":[],"mappings":"AAyBA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getFontSize.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/getFontSize.test.tsx"],"names":[],"mappings":"AAyBA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getOffsetParents.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/getOffsetParents.test.tsx"],"names":[],"mappings":"AAyBA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getScrollParents.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/getScrollParents.test.tsx"],"names":[],"mappings":"AAyBA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isCustomElement.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/isCustomElement.test.tsx"],"names":[],"mappings":"AAwBA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isVisible.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/isVisible.test.tsx"],"names":[],"mappings":"AAyBA,OAAO,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requestAnimationFrame.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/requestAnimationFrame.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformSelection.test.d.ts","sourceRoot":"","sources":["../../src/__new-tests__/transformSelection.test.tsx"],"names":[],"mappings":""}
|