<commit_before>'use babel'

import ModalHandler, {CLASSNAME} from '../lib/ModalHandler'

describe('ModalHandler', () => {
  let modalHandler

  beforeEach(() => {
    modalHandler = new ModalHandler()
    expect(modalHandler).toBeTruthy()
  })

  afterEach(() => {
    modalHandler.destroy()
  })

  it('should not add the class by default', () => {
    const workspaceElement = atom.views.getView(atom.workspace)
    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)
  })

  it('should add attribute with value of true when a modal is open', () => {
    atom.config.set('outlander-ui.showBlur', true)

    const workspaceElement = atom.views.getView(atom.workspace)
    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)

    const testModal = atom.workspace.addModalPanel({item: document.createElement('div')})

    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(true)
    testModal.destroy()
    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)
  })

  it('should not add attribute if setting is disabled', () => {
    atom.config.set('outlander-ui.showBlur', false)

    const workspaceElement = atom.views.getView(atom.workspace)
    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)

    const testModal = atom.workspace.addModalPanel({item: document.createElement('div')})

    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)
  })
})<commit_msg>Add test<commit_after>'use babel'

import ModalHandler, {CLASSNAME} from '../lib/ModalHandler'

describe('ModalHandler', () => {
  let modalHandler

  beforeEach(() => {
    modalHandler = new ModalHandler()
    expect(modalHandler).toBeTruthy()
  })

  afterEach(() => {
    modalHandler.destroy()
  })

  it('should not add the class by default', () => {
    const workspaceElement = atom.views.getView(atom.workspace)
    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)
  })

  it('should add attribute with value of true when a modal is open', () => {
    atom.config.set('outlander-ui.showBlur', true)

    const workspaceElement = atom.views.getView(atom.workspace)
    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)

    const testModal = atom.workspace.addModalPanel({item: document.createElement('div')})

    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(true)
    testModal.destroy()
    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)
  })

  it('should not add attribute if setting is disabled', () => {
    atom.config.set('outlander-ui.showBlur', false)

    const workspaceElement = atom.views.getView(atom.workspace)
    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)

    const testModal = atom.workspace.addModalPanel({item: document.createElement('div')})

    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)
  })

  it('should not add class when the new panel is not visible', () => {
    atom.config.set('outlander-ui.showBlur', true)

    const workspaceElement = atom.views.getView(atom.workspace)
    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)

    const testModal = atom.workspace.addModalPanel({
      item: document.createElement('div'),
      visible: false
    })

    expect(workspaceElement.classList.contains(CLASSNAME)).toBe(false)
  })
})
{'fraction_non_alphanumeric': 0.13898809523809524, 'fraction_numerical': 0.0, 'mean_word_length': 4.658249158249158, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6406017', 'n_tokens_mistral': 999, 'n_tokens_neox': 979, 'n_words': 170}