diff --git a/src/indexes/__test__/__snapshots__/index.test.js.snap b/src/indexes/__test__/__snapshots__/index.test.js.snap
new file mode 100644
index 000000000..32b74f821
--- /dev/null
+++ b/src/indexes/__test__/__snapshots__/index.test.js.snap
@@ -0,0 +1,4446 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`indexes event scroll 1`] = `
+
+
+
+
+
+
+ A
+
+
+
+
+
+
+
+ 阿坝
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 阿拉善
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 阿里
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 安康
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 安庆
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 鞍山
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 安顺
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 安阳
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 澳门
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ B开头
+
+
+
+
+
+
+
+ 北京
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 白银
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 保定
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 宝鸡
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 保山
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 包头
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 巴中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 北海
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 蚌埠
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 本溪
+
+
+
+
+
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
+
+
+
+
+
+
+
+
+
+
+
+
+
+ G开头
+
+
+
+
+
+
+
+ 广州
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 桂林
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 贵阳
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 甘南
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 赣州
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 甘孜
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 广安
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 广元
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 贵港
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 果洛
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A
+
+
+
+
+ B
+
+
+
+
+ C
+
+
+
+
+ D
+
+
+
+
+ E
+
+
+
+
+ F
+
+
+
+
+ G
+
+
+
+
+
+
+
+`;
diff --git a/src/indexes/__test__/contant.ts b/src/indexes/__test__/contant.ts
new file mode 100644
index 000000000..4dc8d764f
--- /dev/null
+++ b/src/indexes/__test__/contant.ts
@@ -0,0 +1,116 @@
+const EXAMPLE = [
+ {
+ index: 'A',
+ children: [
+ { title: '阿坝' },
+ { title: '阿拉善' },
+ { title: '阿里' },
+ { title: '安康' },
+ { title: '安庆' },
+ { title: '鞍山' },
+ { title: '安顺' },
+ { title: '安阳' },
+ { title: '澳门' },
+ ],
+ },
+ {
+ title: 'B开头',
+ index: 'B',
+ children: [
+ { title: '北京' },
+ { title: '白银' },
+ { title: '保定' },
+ { title: '宝鸡' },
+ { title: '保山' },
+ { title: '包头' },
+ { title: '巴中' },
+ { title: '北海' },
+ { title: '蚌埠' },
+ { title: '本溪' },
+ { title: '毕节' },
+ { title: '滨州' },
+ { title: '百色' },
+ { title: '亳州' },
+ ],
+ },
+ {
+ title: 'C开头',
+ index: 'C',
+ children: [
+ { title: '重庆' },
+ { title: '成都' },
+ { title: '长沙' },
+ { title: '长春' },
+ { title: '沧州' },
+ { title: '常德' },
+ { title: '昌都' },
+ { title: '长治' },
+ { title: '常州' },
+ { title: '巢湖' },
+ { title: '潮州' },
+ { title: '承德' },
+ { title: '郴州' },
+ { title: '赤峰' },
+ { title: '池州' },
+ { title: '崇左' },
+ { title: '楚雄' },
+ { title: '滁州' },
+ { title: '朝阳' },
+ ],
+ },
+ {
+ title: 'D开头',
+ index: 'D',
+ children: [
+ { title: '大连' },
+ { title: '东莞' },
+ { title: '大理' },
+ { title: '丹东' },
+ { title: '大庆' },
+ { title: '大同' },
+ { title: '大兴安岭' },
+ { title: '德宏' },
+ { title: '德阳' },
+ { title: '德州' },
+ { title: '定西' },
+ { title: '迪庆' },
+ { title: '东营' },
+ ],
+ },
+ {
+ title: 'E开头',
+ index: 'E',
+ children: [{ title: '鄂尔多斯' }, { title: '恩施' }, { title: '鄂州' }],
+ },
+ {
+ title: 'F开头',
+ index: 'F',
+ children: [
+ { title: '福州' },
+ { title: '防城港' },
+ { title: '佛山' },
+ { title: '抚顺' },
+ { title: '抚州' },
+ { title: '阜新' },
+ { title: '阜阳' },
+ ],
+ },
+ {
+ title: 'G开头',
+ index: 'G',
+ children: [
+ { title: '广州' },
+ { title: '桂林' },
+ { title: '贵阳' },
+ { title: '甘南' },
+ { title: '赣州' },
+ { title: '甘孜' },
+ { title: '广安' },
+ { title: '广元' },
+ { title: '贵港' },
+ { title: '果洛' },
+ ],
+ },
+];
+
+export default EXAMPLE;
diff --git a/src/indexes/__test__/index.test.js b/src/indexes/__test__/index.test.js
new file mode 100644
index 000000000..8feb55f48
--- /dev/null
+++ b/src/indexes/__test__/index.test.js
@@ -0,0 +1,66 @@
+import simulate from 'miniprogram-simulate';
+import path from 'path';
+import EXAMPLE from './contant';
+
+describe('indexes', () => {
+ const indexes = simulate.load(path.resolve(__dirname, `../indexes`), 't-indexes', {
+ less: true,
+ rootPath: path.resolve(__dirname, '../..'),
+ });
+
+ const id = simulate.load({
+ template: ``,
+ data: {
+ list: EXAMPLE,
+ height: 600,
+ },
+ usingComponents: {
+ 't-indexes': indexes,
+ },
+ });
+
+ it(':props', () => {
+ const comp = simulate.render(id);
+ comp.attach(document.createElement('parent-wrapper'));
+ expect(comp.querySelector('.indexes').data.height).toBe(600);
+ });
+
+ it(':list', () => {
+ const comp = simulate.render(id);
+ comp.attach(document.createElement('parent-wrapper'));
+ expect(comp.querySelector('.indexes').data.list).toStrictEqual(EXAMPLE);
+ const $index = comp.querySelector('.indexes');
+ const $scrollGroup = $index.querySelector('.t-indexes__group');
+ // title不存在时,默认使用index
+ expect($scrollGroup.data.title).toBe('A');
+ });
+
+ it('event scroll', async () => {
+ const comp = simulate.render(id);
+ comp.attach(document.createElement('parent-wrapper'));
+ const $index = comp.querySelector('.indexes');
+ const $scrollView = $index.querySelector('.t-indexes__content');
+
+ // scroll
+ simulate.scroll($scrollView, 50, 3);
+ await simulate.sleep();
+ expect($scrollView.dom.scrollTop).toEqual(50);
+ expect(comp).toMatchSnapshot();
+
+ // touch
+ const $bar = comp.querySelectorAll('.indexes >>> .t-indexes__bar')[0];
+
+ const touch = async () => {
+ $bar.dispatchEvent('touchstart', {
+ touches: [{ x: 0, pageY: 50 }],
+ });
+ $bar.dispatchEvent('touchmove', {
+ touches: [{ x: 0, pageY: 60 }],
+ });
+ $bar.dispatchEvent('touchend', {
+ changedTouches: [{ x: 0, pageY: 60 }],
+ });
+ };
+ touch();
+ });
+});