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

feat(number-field): support long press at spinner #983

Merged
merged 34 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8b1f9c1
feat(number-field): support long press
Sep 23, 2023
3241677
fix(number-field): support clicks according to numerous of clicks
Oct 3, 2023
4224e39
Merge remote-tracking branch 'origin/v7' into feat/support-long-press
Oct 3, 2023
3b9c1f9
Merge branch 'v7' into feat/support-long-press
Theeraphat-Sorasetsakul Oct 3, 2023
81a1457
test(number-field): temp
Oct 4, 2023
dcb32ad
test(number-field): remove unwanted code and fix test
Oct 4, 2023
6c972e2
fix(number-field): remove unused code
Oct 5, 2023
dc7085a
Update packages/elements/src/number-field/__test__/number-field.step.…
Theeraphat-Sorasetsakul Oct 6, 2023
2f41393
Update packages/elements/src/number-field/__test__/number-field.step.…
Theeraphat-Sorasetsakul Oct 6, 2023
7b7fb5c
Update packages/elements/src/number-field/__test__/number-field.step.…
Theeraphat-Sorasetsakul Oct 6, 2023
021f3be
Update packages/elements/src/number-field/__test__/number-field.step.…
Theeraphat-Sorasetsakul Oct 6, 2023
0432e17
refactor(number-field): reduce unwanted function, and fix test case t…
Oct 6, 2023
f2806a7
Merge branch 'v7' into feat/support-long-press
Nantawat-Poothong Oct 9, 2023
f39656f
test(number-field): remove unused code
Oct 9, 2023
643886e
Merge branch 'feat/support-long-press' of https://github.com/Refiniti…
Oct 9, 2023
bbe5c7a
Update packages/elements/src/number-field/index.ts
Theeraphat-Sorasetsakul Oct 9, 2023
2e9918f
Update packages/elements/src/number-field/index.ts
Theeraphat-Sorasetsakul Oct 9, 2023
74fffd4
refactor(number-field): add condition to not do every tapend
Oct 10, 2023
4342eea
Merge branch 'v7' into feat/support-long-press
Theeraphat-Sorasetsakul Oct 10, 2023
75dd391
docs(number-field): reword cleartimer desc function
Oct 10, 2023
c93d577
Merge branch 'feat/support-long-press' of https://github.com/Refiniti…
Oct 10, 2023
c421249
test(number-field): remove unused test
Oct 10, 2023
a84f3f1
Merge branch 'v7' into feat/support-long-press
Theeraphat-Sorasetsakul Oct 16, 2023
f061792
Update packages/elements/src/number-field/__test__/number-field.step.…
Theeraphat-Sorasetsakul Oct 16, 2023
f9b3ba8
test(number-field): fix test case
Oct 16, 2023
d801a3b
Update packages/elements/src/number-field/index.ts
Theeraphat-Sorasetsakul Oct 18, 2023
beb185d
Update packages/elements/src/number-field/index.ts
Theeraphat-Sorasetsakul Oct 18, 2023
a47d4c9
Update packages/elements/src/number-field/index.ts
Theeraphat-Sorasetsakul Oct 18, 2023
1b47e06
Update packages/elements/src/number-field/index.ts
Theeraphat-Sorasetsakul Oct 18, 2023
2a5e98e
Update packages/elements/src/number-field/index.ts
Theeraphat-Sorasetsakul Oct 18, 2023
f45712c
fix(number-field): rename variable
Oct 18, 2023
329ec47
Merge branch 'v7' into feat/support-long-press
Theeraphat-Sorasetsakul Oct 20, 2023
bb72639
Update packages/elements/src/number-field/index.ts
Theeraphat-Sorasetsakul Oct 20, 2023
4d9c5e2
Merge branch 'v7' into feat/support-long-press
wsuwt Oct 20, 2023
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '@refinitiv-ui/elements/number-field';

import '@refinitiv-ui/elemental-theme/light/ef-number-field';
import { elementUpdated, expect, fixture } from '@refinitiv-ui/test-helpers';
import { aTimeout, elementUpdated, expect, fixture, oneEvent } from '@refinitiv-ui/test-helpers';

const UP = 1;
const DOWN = -1;
Expand Down Expand Up @@ -220,4 +220,41 @@ describe('number-field/Step', function () {
await expectValues(el, [-1, -2, -3, -4, -5], UP, -1.5);
});
});

describe('Long press spinner', function () {
const dispatchLongTapEvent = async (el, wait = 1000) => {
setTimeout(() =>
el.dispatchEvent(
new Event('tapstart', {
bubbles: true
})
)
);
await oneEvent(el, 'tapstart');
if (wait) {
await aTimeout(wait);
}
setTimeout(() =>
el.dispatchEvent(
new Event('tapend', {
bubbles: true
})
)
);
await oneEvent(el, 'tapend');
};

it('By tap, Step Up', async function () {
Theeraphat-Sorasetsakul marked this conversation as resolved.
Show resolved Hide resolved
const el = await fixture('<ef-number-field></ef-number-field>');
await dispatchLongTapEvent(el.spinnerUpEl);
await elementUpdated(el);
Nantawat-Poothong marked this conversation as resolved.
Show resolved Hide resolved
expect(Number(el.value)).to.greaterThan(3);
wsuwt marked this conversation as resolved.
Show resolved Hide resolved
});
it('By tap, Step Down', async function () {
const el = await fixture('<ef-number-field></ef-number-field>');
await dispatchLongTapEvent(el.spinnerDownEl);
await elementUpdated(el);
expect(Number(el.value)).to.lessThan(-3);
});
});
});
Loading
Loading