Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/vreg/node_modules/bootstrap-vue/src/components/breadcrumb/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/vreg/node_modules/bootstrap-vue/src/components/breadcrumb/breadcrumb.spec.js
import { mount } from '@vue/test-utils'
import { BBreadcrumb } from './breadcrumb'

describe('breadcrumb', () => {
  it('should have expected default structure', async () => {
    const wrapper = mount(BBreadcrumb)

    expect(wrapper.element.tagName).toBe('OL')
    expect(wrapper.classes()).toContain('breadcrumb')
    expect(wrapper.classes().length).toBe(1)
    expect(wrapper.text()).toBe('')

    wrapper.destroy()
  })

  it('should render default slot when no items provided', async () => {
    const wrapper = mount(BBreadcrumb, {
      slots: {
        default: 'foobar'
      }
    })

    expect(wrapper.element.tagName).toBe('OL')
    expect(wrapper.classes()).toContain('breadcrumb')
    expect(wrapper.classes().length).toBe(1)
    expect(wrapper.text()).toBe('foobar')

    wrapper.destroy()
  })

  it('should accept items', () => {
    const wrapper = mount(BBreadcrumb, {
      propsData: {
        items: [
          { text: 'Home', href: '/' },
          { text: 'Admin', to: '/admin', active: false },
          { html: '<b>Manage</b>', href: '/admin/manage' },
          // Test with non object
          'Library'
        ]
      }
    })

    expect(wrapper.element.tagName).toBe('OL')
    expect(wrapper.classes()).toContain('breadcrumb')
    expect(wrapper.classes().length).toBe(1)
    expect(wrapper.findAll('li').length).toBe(4)
    expect(wrapper.findAll('li.breadcrumb-item').length).toBe(4)
    const $lis = wrapper.findAll('li')

    // HREF testing
    expect(
      $lis
        .at(0)
        .find('a')
        .exists()
    ).toBe(true)
    expect(
      $lis
        .at(0)
        .find('a')
        .attributes('href')
    ).toBe('/')
    expect($lis.at(0).text()).toBe('Home')

    expect(
      $lis
        .at(1)
        .find('a')
        .exists()
    ).toBe(true)
    expect(
      $lis
        .at(1)
        .find('a')
        .attributes('href')
    ).toBe('/admin')
    expect($lis.at(1).text()).toBe('Admin')

    expect(
      $lis
        .at(2)
        .find('a')
        .exists()
    ).toBe(true)
    expect(
      $lis
        .at(2)
        .find('a')
        .attributes('href')
    ).toBe('/admin/manage')
    expect($lis.at(2).text()).toBe('Manage')

    // Last item should have active state
    expect($lis.at(3).classes()).toContain('active')
    expect(
      $lis
        .at(3)
        .find('span')
        .exists()
    ).toBe(true)
    expect($lis.at(3).text()).toBe('Library')

    wrapper.destroy()
  })

  it('should apply active class to active item', async () => {
    const wrapper = mount(BBreadcrumb, {
      propsData: {
        items: [
          { text: 'Home', href: '/' },
          { text: 'Admin', to: '/admin', active: true },
          { html: '<b>Manage</b>', href: '/admin/manage' },
          { text: 'Library', href: '/admin/manage/library' }
        ]
      }
    })

    expect(wrapper.element.tagName).toBe('OL')
    expect(wrapper.classes()).toContain('breadcrumb')
    expect(wrapper.classes().length).toBe(1)
    expect(wrapper.findAll('li').length).toBe(4)
    expect(wrapper.findAll('li.breadcrumb-item').length).toBe(4)
    const $lis = wrapper.findAll('li')

    // HREF testing
    expect(
      $lis
        .at(0)
        .find('a')
        .exists()
    ).toBe(true)
    expect(
      $lis
        .at(0)
        .find('a')
        .attributes('href')
    ).toBe('/')
    expect($lis.at(0).text()).toBe('Home')

    // This one should be a span/active
    expect(
      $lis
        .at(1)
        .find('span')
        .exists()
    ).toBe(true)
    expect($lis.at(1).classes()).toContain('active')
    expect($lis.at(1).text()).toBe('Admin')

    expect(
      $lis
        .at(2)
        .find('a')
        .exists()
    ).toBe(true)
    expect(
      $lis
        .at(2)
        .find('a')
        .attributes('href')
    ).toBe('/admin/manage')
    expect($lis.at(2).text()).toBe('Manage')

    // Last item should have active state
    expect($lis.at(3).classes()).not.toContain('active')
    expect(
      $lis
        .at(3)
        .find('a')
        .exists()
    ).toBe(true)
    expect(
      $lis
        .at(3)
        .find('a')
        .attributes('href')
    ).toBe('/admin/manage/library')
    expect($lis.at(3).text()).toBe('Library')

    wrapper.destroy()
  })
})

Spamworldpro Mini