Merge branch '2.x' into dev

This commit is contained in:
chenjiahan
2020-11-15 11:16:02 +08:00
7 changed files with 46 additions and 48 deletions
+2 -12
View File
@@ -1,13 +1,5 @@
import { mount, trigger, triggerDrag, mockScrollIntoView } from '../../../test';
function mockOffsetHeight(offsetHeight) {
Object.defineProperty(HTMLElement.prototype, 'offsetHeight', {
get() {
return offsetHeight;
},
});
}
test('should allow to custom anchor text', () => {
const wrapper = mount({
template: `
@@ -97,11 +89,10 @@ test('should update active anchor after page scroll', () => {
const { index } = this.dataset;
return {
top: index ? index * 10 : 0,
height: 10,
};
};
mockOffsetHeight(10);
const wrapper = mount({
template: `
<van-index-bar :sticky="sticky">
@@ -138,11 +129,10 @@ test('should emit change event when active index changed', () => {
const { index } = this.dataset;
return {
top: index ? index * 10 : 0,
height: 10,
};
};
mockOffsetHeight(10);
const onChange = jest.fn();
mount({