diff --git a/docs/pages/playground.vue b/docs/pages/playground.vue index dc02d415d..4daf89e40 100644 --- a/docs/pages/playground.vue +++ b/docs/pages/playground.vue @@ -1,29 +1,1372 @@ @@ -32,10 +1375,10 @@ \ No newline at end of file + + + + diff --git a/lib/KCard/BaseCard.vue b/lib/KCard/BaseCard.vue deleted file mode 100644 index 43c35764f..000000000 --- a/lib/KCard/BaseCard.vue +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/lib/KCard/__tests__/KCard.spec.js b/lib/KCard/__tests__/KCard.spec.js index 6a72dd20c..f4c92c0dc 100644 --- a/lib/KCard/__tests__/KCard.spec.js +++ b/lib/KCard/__tests__/KCard.spec.js @@ -13,14 +13,22 @@ function makeWrapper({ propsData = {}, slots = {} } = {}) { return mount(KCard, { router, propsData, slots, localVue }); } -/* checks the expected card markup: -
  • - - Test Title - - - all other content -
  • */ +/* + Checks the expected card markup: + +
  • +
    + + Test Title + +
    + + all other content +
  • + + "li > h[2-6] > a > title text" structure that comes before + all other content is crucial to ensure accessibility. +*/ function checkExpectedCardMarkup({ wrapper, headingLevel, title }) { const firstElement = wrapper.find(':first-child'); expect(firstElement.exists()).toBe(true); @@ -28,13 +36,17 @@ function checkExpectedCardMarkup({ wrapper, headingLevel, title }) { const secondElement = wrapper.find('li > :first-child'); expect(secondElement.exists()).toBe(true); - expect(secondElement.element.tagName.toLowerCase()).toBe(`h${headingLevel}`); + expect(secondElement.element.tagName.toLowerCase()).toBe('div'); - const thirdElement = wrapper.find(`h${headingLevel} > :first-child`); - expect(thirdElement.element.tagName.toLowerCase()).toBe('a'); + const thirdElement = wrapper.find('li > div > :first-child'); expect(thirdElement.exists()).toBe(true); + expect(thirdElement.element.tagName.toLowerCase()).toBe(`h${headingLevel}`); - const linkText = thirdElement.text(); + const fourthElement = wrapper.find(`li > div > h${headingLevel} > :first-child`); + expect(fourthElement.element.tagName.toLowerCase()).toBe('a'); + expect(fourthElement.exists()).toBe(true); + + const linkText = fourthElement.text(); expect(linkText).toBe(title); } @@ -72,7 +84,7 @@ describe('KCard', () => { await wrapper.find('li').trigger('mousedown'); await new Promise(resolve => setTimeout(resolve, 500)); - await wrapper.find('li').trigger('mouseup'); + await wrapper.find('li').trigger('click'); expect(wrapper.vm.$router.currentRoute.path).not.toBe('/some-link'); }); @@ -83,7 +95,7 @@ describe('KCard', () => { await wrapper.find('li').trigger('mousedown'); await new Promise(resolve => setTimeout(resolve, 100)); - await wrapper.find('li').trigger('mouseup'); + await wrapper.find('li').trigger('click'); expect(wrapper.vm.$router.currentRoute.path).toBe('/some-link'); }); diff --git a/lib/KCard/index.vue b/lib/KCard/index.vue index 21270058d..a1ed4558e 100644 --- a/lib/KCard/index.vue +++ b/lib/KCard/index.vue @@ -1,20 +1,63 @@ @@ -366,24 +421,54 @@