File "getAttribute.test.ts"

Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/utils/dom/getAttribute/getAttribute.test.ts
File size: 609 B (609 B bytes)
MIME-type: text/x-java
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

import { getAttribute } from './getAttribute';


describe( 'getAttribute', () => {
  beforeEach( () => {
    document.body.innerHTML = '<div id="container"></div>';
  } );

  test( 'can set an attribute to an element.', () => {
    const container = document.getElementById( 'container' );

    container.setAttribute( 'aria-hidden', 'true' );
    container.setAttribute( 'tabindex', '-1' );

    expect( getAttribute( container, 'id' ) ).toBe( 'container' );
    expect( getAttribute( container, 'aria-hidden' ) ).toBe( 'true' );
    expect( getAttribute( container, 'tabindex' ) ).toBe( '-1' );
  } );
} );