Browse Source

Carousel: update doc and test for indicator labels (#4551)

杨奕 8 years ago
parent
commit
72b1bc3c10

+ 1 - 0
examples/docs/en-US/carousel.md

@@ -187,3 +187,4 @@ When a page is wide enough but has limited height, you can activate card mode fo
 | Attribute      | Description          | Type      | Accepted Values       | Default  |
 |---------- |-------------- |---------- |--------------------------------  |-------- |
 | name | name of the item, can be used in `setActiveItem` | string | — | — |
+| label | text content for the corresponding indicator | string | — | — |

+ 1 - 0
examples/docs/zh-CN/carousel.md

@@ -236,3 +236,4 @@
 | 参数      | 说明          | 类型      | 可选值                           | 默认值  |
 |---------- |-------------- |---------- |--------------------------------  |-------- |
 | name | 幻灯片的名字,可用作 `setActiveItem` 的参数 | string | — | — |
+| label | 该幻灯片所对应指示器的文本 | string | — | — |

+ 16 - 0
test/unit/specs/carousel.spec.js

@@ -113,6 +113,22 @@ describe('Carousel', () => {
     }, 60);
   });
 
+  it('label', done => {
+    vm = createVue({
+      template: `
+        <div>
+          <el-carousel>
+            <el-carousel-item v-for="item in 3" :key="item" :label="item"></el-carousel-item>
+          </el-carousel>
+        </div>
+      `
+    });
+    setTimeout(_ => {
+      expect(vm.$el.querySelector('.el-carousel__button').innerText).to.equal('1');
+      done();
+    }, 10);
+  });
+
   describe('manual control', () => {
     it('hover', done => {
       vm = createVue({