<commit_before>'use babel';

MockDate = require('mockdate')

getTooltips = function(workspaceElement) {
  element = workspaceElement.querySelector('.atom-clock')
  return atom.tooltips.findTooltips(element)
}

getTooltipDate = function(workspaceElement) {
  tooltip = getTooltips(workspaceElement)[0]
  return tooltip.getTitle()
}

describe('Atom Clock', () => {

  let workspaceElement

  beforeEach(() => {
    workspaceElement = atom.views.getView(atom.workspace)
    jasmine.attachToDOM(workspaceElement)
    MockDate.set('1987-04-11 04:00')

    let statusBar
    let AtomClock

    waitsForPromise(() => atom.packages.activatePackage('status-bar').then((pack) => {
      statusBar = workspaceElement.querySelector('status-bar')
    }))

    waitsForPromise(() => atom.packages.activatePackage('atom-clock').then((clk) => {
      AtomClock = clk.mainModule
      AtomClock.consumeStatusBar(statusBar)
    }))

    waitsForPromise(() => atom.workspace.open())
  })

  afterEach(() => {
    MockDate.reset()
  })

  it('should not show the tooltip by default', () => {
    expect(getTooltips(workspaceElement)[0].enabled).toBe(false)
  })

  it('should show the tooltip when configured', () => {
    atom.config.set('atom-clock.showTooltip', true)
    expect(getTooltips(workspaceElement)[0].enabled).toBe(true)
  })

  it('should not show the clock icon by default', () => {
    icon = workspaceElement.querySelector('.atom-clock > .icon-clock')
    expect(icon).toBeNull()
  })

  it('should show the clock icon when configured', () => {
    atom.config.set('atom-clock.showClockIcon', true)
    icon = workspaceElement.querySelector('.atom-clock > .icon-clock')
    expect(icon).not.toBeNull()
  })

  it('should show the time with the default format', () => {
    date = workspaceElement.querySelector('.atom-clock > span').innerText
    expect(date).toBe('4:00')
  })

  it('should show the time in the tooltip with the default format', () => {
    atom.config.set('atom-clock.showTooltip', true)
    date = getTooltipDate(workspaceElement)
    expect(date.toLowerCase()).toBe('saturday, april 11, 1987 4:00 am')
  })

  it('should change the format of displayed time', () => {
    atom.config.set('atom-clock.dateFormat', 'H:mm:ss')
    date = workspaceElement.querySelector('.atom-clock > span').innerText
    expect(date).toBe('4:00:00')

    atom.config.set('atom-clock.dateFormat', 'DD dddd YY H:mm')
    date = workspaceElement.querySelector('.atom-clock > span').innerText
    expect(date.toLowerCase()).toBe('11 saturday 87 4:00')
  })

  it('should change the format of the displayed time in the tooltip', () => {
    atom.config.set('atom-clock.showTooltip', true)

    atom.config.set('atom-clock.tooltipDateFormat', 'H:mm:ss')
    tooltip = getTooltips(workspaceElement)[0]
    date = getTooltipDate(workspaceElement)
    expect(date).toBe('4:00:00')

    atom.config.set('atom-clock.tooltipDateFormat', 'DD dddd YY H:mm')
    tooltip = getTooltips(workspaceElement)[0]
    date = getTooltipDate(workspaceElement)
    expect(date.toLowerCase()).toBe('11 saturday 87 4:00')
  })

  it('should change the clock content according with the locale', () => {
    atom.config.set('atom-clock.dateFormat', 'DD dddd YY H:mm')
    atom.config.set('atom-clock.locale', 'it')
    date = workspaceElement.querySelector('.atom-clock > span').innerText
    expect(date.toLowerCase()).toBe('11 sabato 87 4:00')
  })

  it('should change the clock content in the tooltip according with the locale', () => {
    atom.config.set('atom-clock.tooltipDateFormat', 'DD dddd YY H:mm')
    atom.config.set('atom-clock.locale', 'it')
    date = getTooltipDate(workspaceElement)
    expect(date.toLowerCase()).toBe('11 sabato 87 4:00')
  })

})<commit_msg>Removing unnecessary statements from tooltip specs<commit_after>'use babel';

MockDate = require('mockdate')

getTooltips = function(workspaceElement) {
  element = workspaceElement.querySelector('.atom-clock')
  return atom.tooltips.findTooltips(element)
}

getTooltipDate = function(workspaceElement) {
  tooltip = getTooltips(workspaceElement)[0]
  return tooltip.getTitle()
}

describe('Atom Clock', () => {

  let workspaceElement

  beforeEach(() => {
    workspaceElement = atom.views.getView(atom.workspace)
    jasmine.attachToDOM(workspaceElement)
    MockDate.set('1987-04-11 04:00')

    let statusBar
    let AtomClock

    waitsForPromise(() => atom.packages.activatePackage('status-bar').then((pack) => {
      statusBar = workspaceElement.querySelector('status-bar')
    }))

    waitsForPromise(() => atom.packages.activatePackage('atom-clock').then((clk) => {
      AtomClock = clk.mainModule
      AtomClock.consumeStatusBar(statusBar)
    }))

    waitsForPromise(() => atom.workspace.open())
  })

  afterEach(() => {
    MockDate.reset()
  })

  it('should not show the tooltip by default', () => {
    expect(getTooltips(workspaceElement)[0].enabled).toBe(false)
  })

  it('should show the tooltip when configured', () => {
    atom.config.set('atom-clock.showTooltip', true)
    expect(getTooltips(workspaceElement)[0].enabled).toBe(true)
  })

  it('should not show the clock icon by default', () => {
    icon = workspaceElement.querySelector('.atom-clock > .icon-clock')
    expect(icon).toBeNull()
  })

  it('should show the clock icon when configured', () => {
    atom.config.set('atom-clock.showClockIcon', true)
    icon = workspaceElement.querySelector('.atom-clock > .icon-clock')
    expect(icon).not.toBeNull()
  })

  it('should show the time with the default format', () => {
    date = workspaceElement.querySelector('.atom-clock > span').innerText
    expect(date).toBe('4:00')
  })

  it('should show the time in the tooltip with the default format', () => {
    date = getTooltipDate(workspaceElement)
    expect(date.toLowerCase()).toBe('saturday, april 11, 1987 4:00 am')
  })

  it('should change the format of displayed time', () => {
    atom.config.set('atom-clock.dateFormat', 'H:mm:ss')
    date = workspaceElement.querySelector('.atom-clock > span').innerText
    expect(date).toBe('4:00:00')

    atom.config.set('atom-clock.dateFormat', 'DD dddd YY H:mm')
    date = workspaceElement.querySelector('.atom-clock > span').innerText
    expect(date.toLowerCase()).toBe('11 saturday 87 4:00')
  })

  it('should change the format of the displayed time in the tooltip', () => {
    atom.config.set('atom-clock.tooltipDateFormat', 'H:mm:ss')
    date = getTooltipDate(workspaceElement)
    expect(date).toBe('4:00:00')

    atom.config.set('atom-clock.tooltipDateFormat', 'DD dddd YY H:mm')
    date = getTooltipDate(workspaceElement)
    expect(date.toLowerCase()).toBe('11 saturday 87 4:00')
  })

  it('should change the clock content according with the locale', () => {
    atom.config.set('atom-clock.dateFormat', 'DD dddd YY H:mm')
    atom.config.set('atom-clock.locale', 'it')
    date = workspaceElement.querySelector('.atom-clock > span').innerText
    expect(date.toLowerCase()).toBe('11 sabato 87 4:00')
  })

  it('should change the clock content in the tooltip according with the locale', () => {
    atom.config.set('atom-clock.tooltipDateFormat', 'DD dddd YY H:mm')
    atom.config.set('atom-clock.locale', 'it')
    date = getTooltipDate(workspaceElement)
    expect(date.toLowerCase()).toBe('11 sabato 87 4:00')
  })

})
{'fraction_non_alphanumeric': 0.15812431842966193, 'fraction_numerical': 0.017993456924754635, 'mean_word_length': 4.177840508115738, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 51, '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': '1334947', 'n_tokens_mistral': 2386, 'n_tokens_neox': 2297, 'n_words': 445}