Skip to content

Commit a9608bb

Browse files
test(sticky): created test cases for the sticky component (#827)
* test(sticky): created test cases for the sticky component * test(sticky): updated the coverage of the sticky component
1 parent 812d413 commit a9608bb

File tree

4 files changed

+782
-2
lines changed

4 files changed

+782
-2
lines changed

site/test-coverage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module.exports = {
5353
slider: { statements: '97.74%', branches: '96.49%', functions: '100%', lines: '97.68%' },
5454
stepper: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
5555
steps: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
56-
sticky: { statements: '67.85%', branches: '30%', functions: '85.71%', lines: '69.09%' },
56+
sticky: { statements: '100%', branches: '90%', functions: '100%', lines: '100%' },
5757
swipeCell: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
5858
swiper: { statements: '57.55%', branches: '37.1%', functions: '67.6%', lines: '59.74%' },
5959
switch: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },

src/sticky/Sticky.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ const Sticky: FC<StickyProps> = (originProps) => {
6464
};
6565

6666
let isFixed = false;
67-
if (disabled) return style;
67+
if (disabled) {
68+
setContentStyles(style);
69+
return;
70+
}
6871
const offsetTopNum = Number(offsetTop);
6972

7073
if (containerRef.current) {

0 commit comments

Comments
 (0)