Browse Source

Merge branch 'v3-dev' of https://github.com/jdf2e/nutui into v3-dev

杨小璐 5 years ago
parent
commit
7cc5f1f6b7

+ 7 - 7
src/packages/button/__test__/button.spec.js

@@ -12,12 +12,12 @@ describe('Button.vue', () => {
         wrapper.setProps({
         wrapper.setProps({
             type: 'light'
             type: 'light'
         })
         })
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.attributes('class')).toContain('light');
             expect(wrapper.attributes('class')).toContain('light');
         })
         })
     });
     });
     it('设置slot', () => {
     it('设置slot', () => {
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.text()).toBe('去结算');
             expect(wrapper.text()).toBe('去结算');
         })
         })
     });
     });
@@ -25,7 +25,7 @@ describe('Button.vue', () => {
         wrapper.setProps({
         wrapper.setProps({
             disabled: true
             disabled: true
         })
         })
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.text()).toBe('去结算');
             expect(wrapper.text()).toBe('去结算');
             expect(wrapper.attributes('disabled')).toContain('disabled');
             expect(wrapper.attributes('disabled')).toContain('disabled');
         })
         })
@@ -34,7 +34,7 @@ describe('Button.vue', () => {
         wrapper.setProps({
         wrapper.setProps({
             shape: 'circle'
             shape: 'circle'
         })
         })
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.text()).toBe('去结算');
             expect(wrapper.text()).toBe('去结算');
             expect(wrapper.attributes('class')).toContain('circle');
             expect(wrapper.attributes('class')).toContain('circle');
         })
         })
@@ -43,7 +43,7 @@ describe('Button.vue', () => {
         wrapper.setProps({
         wrapper.setProps({
             size: 'small'
             size: 'small'
         })
         })
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.text()).toBe('去结算');
             expect(wrapper.text()).toBe('去结算');
             expect(wrapper.attributes('class')).toContain('small');
             expect(wrapper.attributes('class')).toContain('small');
         })
         })
@@ -53,7 +53,7 @@ describe('Button.vue', () => {
             type: 'actived',
             type: 'actived',
             icon: 'tick'
             icon: 'tick'
         })
         })
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.text()).toBe('去结算');
             expect(wrapper.text()).toBe('去结算');
             expect(wrapper.contains('.txt-icon')).toBe(true);
             expect(wrapper.contains('.txt-icon')).toBe(true);
             expect(wrapper.find('.txt-icon').attributes('type')).toBe('tick');
             expect(wrapper.find('.txt-icon').attributes('type')).toBe('tick');
@@ -65,7 +65,7 @@ describe('Button.vue', () => {
             icon: 'tick',
             icon: 'tick',
             color: '#fff'
             color: '#fff'
         })
         })
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.text()).toBe('去结算');
             expect(wrapper.text()).toBe('去结算');
             expect(wrapper.find('span').attributes('style')).toBe('color: rgb(255, 255, 255);');
             expect(wrapper.find('span').attributes('style')).toBe('color: rgb(255, 255, 255);');
             expect(wrapper.find('.txt-icon').attributes('color')).toBe('#fff');
             expect(wrapper.find('.txt-icon').attributes('color')).toBe('#fff');

+ 38 - 34
src/packages/button/demo.vue

@@ -1,5 +1,5 @@
 <template>
 <template>
-  <div>
+  <div class="btn-demo">
     <h4>按钮状态</h4>
     <h4>按钮状态</h4>
     <div class="btn-state">
     <div class="btn-state">
       <nut-button block>默认状态</nut-button>
       <nut-button block>默认状态</nut-button>
@@ -113,51 +113,55 @@ export default {
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
+.btn-demo {
+  padding: 0 15px;
+}
 .bg {
 .bg {
-	margin: 0 10px;
+  margin: 0 10px;
 }
 }
 
 
 .gap {
 .gap {
-	height: 10px;
+  height: 10px;
 }
 }
 
 
 .white-bg {
 .white-bg {
-	padding: 10px;
-	background: #fff;
+  padding: 10px;
+  background: #fff;
 }
 }
 
 
 .btn-state {
 .btn-state {
-	button {
-		margin-bottom: 10px;
-	}
+  button {
+    margin-bottom: 10px;
+    border-radius: 4px;
+  }
 }
 }
 
 
 .btn-size {
 .btn-size {
-	display: flex;
-	align-items: flex-end;
-	justify-content: space-around;
-	margin-top: 24px;
-
-	&.two {
-		button {
-			width: 168px;
-		}
-	}
-
-	&.three {
-		button {
-			width: 109px;
-		}
-	}
-
-	&.four {
-		button {
-			width: 79px;
-		}
-
-		.middle {
-			padding: 0;
-		}
-	}
+  display: flex;
+  align-items: flex-end;
+  justify-content: space-around;
+  margin-top: 24px;
+
+  &.two {
+    button {
+      width: 168px;
+    }
+  }
+
+  &.three {
+    button {
+      width: 108px;
+    }
+  }
+
+  &.four {
+    button {
+      width: 79px;
+    }
+
+    .middle {
+      padding: 0;
+    }
+  }
 }
 }
 </style>
 </style>

+ 16 - 16
src/packages/dialog/__test__/dialog.spec.js

@@ -4,13 +4,12 @@ import Vue from 'vue';
 
 
 
 
 describe('Dialog.vue', () => {
 describe('Dialog.vue', () => {
-    const wrapper = shallowMount(Dialog, {
-    });
+    const wrapper = shallowMount(Dialog, {});
 
 
     it('可见', () => {
     it('可见', () => {
         wrapper.setProps({ title: '测试标题', visible: true });
         wrapper.setProps({ title: '测试标题', visible: true });
 
 
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.find('.nut-dialog-mask').isVisible()).toBe(true);
             expect(wrapper.find('.nut-dialog-mask').isVisible()).toBe(true);
             expect(wrapper.find('.nut-dialog-box').isVisible()).toBe(true);
             expect(wrapper.find('.nut-dialog-box').isVisible()).toBe(true);
         })
         })
@@ -19,15 +18,15 @@ describe('Dialog.vue', () => {
     it('隐藏', () => {
     it('隐藏', () => {
         wrapper.setProps({ title: '测试标题', visible: false });
         wrapper.setProps({ title: '测试标题', visible: false });
 
 
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.find('.nut-dialog-box').isVisible()).toBe(false);
             expect(wrapper.find('.nut-dialog-box').isVisible()).toBe(false);
         })
         })
     });
     });
 
 
     it('内容文案展示', () => {
     it('内容文案展示', () => {
-        wrapper.setProps({ content: '测试文案', visible:true });
+        wrapper.setProps({ content: '测试文案', visible: true });
 
 
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.find('.nut-dialog-content').exists()).toBe(true);
             expect(wrapper.find('.nut-dialog-content').exists()).toBe(true);
         })
         })
     });
     });
@@ -35,40 +34,41 @@ describe('Dialog.vue', () => {
     it('标题文案展示', () => {
     it('标题文案展示', () => {
         wrapper.setProps({ title: '测试标题', visible: true });
         wrapper.setProps({ title: '测试标题', visible: true });
 
 
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.find('.nut-dialog-title').exists()).toBe(true);
             expect(wrapper.find('.nut-dialog-title').exists()).toBe(true);
         })
         })
     });
     });
 
 
     it('隐藏底栏', () => {
     it('隐藏底栏', () => {
-        wrapper.setProps({ title: '测试标题', visible: true, noFooter:true });
+        wrapper.setProps({ title: '测试标题', visible: true, noFooter: true });
 
 
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.find('.nut-dialog-footer').exists()).toBe(false);
             expect(wrapper.find('.nut-dialog-footer').exists()).toBe(false);
         })
         })
-    }); 
+    });
 
 
     it('隐藏确定键', () => {
     it('隐藏确定键', () => {
         wrapper.setProps({ title: '测试标题', visible: true, noOkBtn: true });
         wrapper.setProps({ title: '测试标题', visible: true, noOkBtn: true });
 
 
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.find('.nut-dialog-ok').exists()).toBe(false);
             expect(wrapper.find('.nut-dialog-ok').exists()).toBe(false);
         })
         })
     });
     });
 
 
     it('图片弹窗', () => {
     it('图片弹窗', () => {
         wrapper.setProps({
         wrapper.setProps({
-            visible: true, 
-            type: 'image', 
+            visible: true,
+            type: 'image',
             link: "http://m.jd.com",
             link: "http://m.jd.com",
-            imgSrc: "https://m.360buyimg.com/mobilecms/s750x750_jfs/t1/4875/23/1968/285655/5b9549eeE4997a18c/070eaf5bddf26be8.jpg", });
+            imgSrc: "https://m.360buyimg.com/mobilecms/s750x750_jfs/t1/4875/23/1968/285655/5b9549eeE4997a18c/070eaf5bddf26be8.jpg",
+        });
 
 
-        return Vue.nextTick().then(function () {
+        return Vue.nextTick().then(function() {
             expect(wrapper.find('.nut-dialog-link').exists()).toBe(true);
             expect(wrapper.find('.nut-dialog-link').exists()).toBe(true);
             expect(wrapper.find('.nut-dialog-image').exists()).toBe(true);
             expect(wrapper.find('.nut-dialog-image').exists()).toBe(true);
             expect(wrapper.find('.nut-dialog-image').attributes('src')).toBe('https://m.360buyimg.com/mobilecms/s750x750_jfs/t1/4875/23/1968/285655/5b9549eeE4997a18c/070eaf5bddf26be8.jpg');
             expect(wrapper.find('.nut-dialog-image').attributes('src')).toBe('https://m.360buyimg.com/mobilecms/s750x750_jfs/t1/4875/23/1968/285655/5b9549eeE4997a18c/070eaf5bddf26be8.jpg');
             expect(wrapper.find('.nut-dialog-body').exists()).toBe(false);
             expect(wrapper.find('.nut-dialog-body').exists()).toBe(false);
-            
+
         })
         })
     });
     });
 });
 });

+ 21 - 0
src/packages/field/__test__/field.spec.js

@@ -0,0 +1,21 @@
+import { shallowMount, mount } from '@vue/test-utils'
+import ActionSheet from '../field.vue'
+import Vue from 'vue';
+
+
+describe('Field.vue', () => {
+    const wrapper = shallowMount(Field, {
+        propsData: {
+            label: '自我介绍',
+            type: "text"
+        }
+    });
+
+    // it('图标展示', () => {
+    //     //wrapper.setProps({ type: 'top' });
+
+    //     return Vue.nextTick().then(function() {
+    //         expect(wrapper.contains('.nut-icon-top')).toBe(true);
+    //     })
+    // });
+});

+ 3 - 4
src/packages/noticebar/noticebar.scss

@@ -2,13 +2,12 @@
   display: flex;
   display: flex;
   height: 40px;
   height: 40px;
   padding: 0 16px;
   padding: 0 16px;
-  font-size: 14px;
+  font-size: $font-size-display-normal;
   line-height: 24px;
   line-height: 24px;
   position: relative;
   position: relative;
   align-items: center;
   align-items: center;
-  color: $text-color;
-  background-color: rgba(251, 248, 220, 1);
-  color: rgba(211, 125, 066, 1);
+  color: #F9911B;
+  background-color: #FFF4DA;
   &.wrapable{
   &.wrapable{
     height: auto;
     height: auto;
     padding: 8px 16px;
     padding: 8px 16px;

+ 1 - 4
src/packages/noticebar/noticebar.vue

@@ -50,7 +50,7 @@ export default {
     },
     },
     background: {
     background: {
       type: String,
       type: String,
-      default: 'rgba(254,250,216,1)'
+      default: '#FFF4DA'
     },
     },
     delay: {
     delay: {
       type: [String, Number],
       type: [String, Number],
@@ -107,8 +107,6 @@ export default {
   watch: {
   watch: {
     text: {
     text: {
       handler(val, newVal) {
       handler(val, newVal) {
-        console.log(val, newVal, this.showNoticeBar == false, 'text');
-
         if (this.showNoticeBar == false) {
         if (this.showNoticeBar == false) {
           return;
           return;
         }
         }
@@ -121,7 +119,6 @@ export default {
           const wrapWidth = wrap.getBoundingClientRect().width;
           const wrapWidth = wrap.getBoundingClientRect().width;
 
 
           const offsetWidth = content.getBoundingClientRect().width;
           const offsetWidth = content.getBoundingClientRect().width;
-          console.log(wrapWidth, offsetWidth, 'text222');
 
 
           if (this.scrollable && offsetWidth > wrapWidth) {
           if (this.scrollable && offsetWidth > wrapWidth) {
             this.wrapWidth = wrapWidth;
             this.wrapWidth = wrapWidth;