Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
showModal(modalName: string, activist: Activist, index: number) {
// Check to see if there's a modal open, and close it if so.
if (this.currentModalName) {
this.hideModal();
}
// Show the modal in the next tick so that this code runs after
// vue has hidden the previous modal.
Vue.nextTick(() => {
this.currentActivist = activist;
if (index != undefined) {
this.activistIndex = index; // needed for updating activist
} else {
this.activistIndex = -1;
}
this.currentModalName = modalName;
this.$modal.show(modalName);
});
},
hideModal() {
it('链接', () => {
wrapper.setProps({ title: '测试title', subTitle: '测试subTitle', desc: '测试desc', showIcon: true, isLink: true, linkUrl:'http://m.jd.com' });
return Vue.nextTick().then(function () {
expect(wrapper.classes('nut-cell-link')).toBe(true);
expect(wrapper.attributes('href')).toBe('http://m.jd.com');
})
});
});
it('selecting a row should enable delete button', done => {
const deleteBtn = findDeleteButton();
const checkboxes = findSelectCheckboxes();
expect(deleteBtn.attributes('disabled')).toBe('disabled');
checkboxes.at(0).trigger('click');
Vue.nextTick(() => {
expect(deleteBtn.attributes('disabled')).toEqual(undefined);
done();
});
});
it('does not render label if label does not have an ID', done => {
component.issue.addLabel(
new ListLabel({
title: 'closed',
}),
);
Vue.nextTick()
.then(() => {
expect(component.$el.querySelectorAll('.badge').length).toBe(2);
expect(component.$el.textContent).not.toContain('closed');
done();
})
.catch(done.fail);
});
});
refreshPage({ commit }, routeName) {
commit('setRefreshPageMap', { key: routeName, value: true });
Vue.nextTick(() => {
commit('setRefreshPageMap', { key: routeName, value: false });
});
},
},
it('calls parent enter action first and leave action last', async () => {
const callOrder = []
test.actions.beforeEnter.mockImplementationOnce(() => callOrder.push('parentEnter'))
test.actions.beforeEnterChild.mockImplementationOnce(() => callOrder.push('childEnter'))
test.actions.afterLeave.mockImplementationOnce(() => callOrder.push('parentLeave'))
test.actions.afterLeaveChild.mockImplementationOnce(() => callOrder.push('childLeave'))
router.push({ name: 'child', params: { testId: '42', childId: '44' } })
await Vue.nextTick(); await Vue.nextTick()
router.push({ name: 'route2' })
await Vue.nextTick()
expect(test.actions.beforeEnter.mock.calls[0][1]).toHaveProperty('testId', 42)
expect(test.actions.beforeEnter.mock.calls[0][1]).toHaveProperty('childId', 44)
expect(test.actions.beforeEnterChild.mock.calls[0][1]).toHaveProperty('testId', 42)
expect(test.actions.beforeEnterChild.mock.calls[0][1]).toHaveProperty('childId', 44)
expect(callOrder).toEqual(['parentEnter', 'childEnter', 'childLeave', 'parentLeave'])
})
})
chooseSelected() {
if (this.data[this.selected] !== undefined) {
this.$emit('selected', this.data[this.selected])
this.$refs.input.focus()
Vue.nextTick(() => this.close())
}
},
dialogVisible () {
if (this.dialogVisible === true) {
Vue.nextTick(() => {
(this.$refs.inputField as HTMLInputElement).focus();
});
}
},
},
setHeight(value, prop = 'height') {
if (Vue.prototype.$isServer) return;
const el = this.table.$el;
value = parseHeight(value);
this.height = value;
if (!el && (value || value === 0)) return Vue.nextTick(() => this.setHeight(value, prop));
if (typeof value === 'number') {
el.style[prop] = value + 'px';
this.updateElsHeight();
} else if (typeof value === 'string') {
el.style[prop] = value;
this.updateElsHeight();
}
}
setTimeout(() => {
vm.$el.querySelector('.js-note-edit').click();
Vue.nextTick(done);
}, 0);
});