Sha256: 63e7b1e3466197d41fd86efd7bc3f364469e12a5bdf07aa359a745742c05a36c

Contents?: true

Size: 1.31 KB

Versions: 284

Compression:

Stored size: 1.31 KB

Contents

import { ensureAccessible, renderKit } from '../utilities/test-utils'
import { DateTimeStacked } from '../'

/* eslint-disable jsx-control-statements/jsx-jcs-no-undef */
const currentDate = new Date()

const datetime = new Date('Wed Mar 31 2021 12:00:00 GMT-0500'),
  monthName = datetime.toLocaleString('en-US', { month: 'short' }),
  day = datetime.getDate(),
  fullYear = datetime.getFullYear(),
  optionalYear = currentDate.getFullYear() !== fullYear ? fullYear : ''

const monthDayYear = `${monthName}${day}${optionalYear}`

const props = {
  data: { testid: 'datetimestacked' },
  datetime,
}

test('Kit renders date time', () => {
  const kit = renderKit(DateTimeStacked, props)
  expect(kit).toBeInTheDocument()
})

it('Should be accessible', async () => {
  ensureAccessible(DateTimeStacked, props)
})

test('renders time in default timezone', () => {
  const kit = renderKit(DateTimeStacked, props)
  expect(kit).toHaveTextContent(`${monthDayYear}1:00pEDT`)
})

test('renders time in timezone', () => {
  props.timeZone = 'Asia/Tokyo'
  const kit = renderKit(DateTimeStacked, props)
  expect(kit).toHaveTextContent(`${monthDayYear}2:00aGMT+9`)
})

test('renders time in timezone', () => {
  props.timeZone = 'America/Denver'
  const kit = renderKit(DateTimeStacked, props)
  expect(kit).toHaveTextContent(`${monthDayYear}11:00aMDT`)
})

Version data entries

284 entries across 284 versions & 1 rubygems

Version Path
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1264 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1263 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1262 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.9.0.pre.alpha.PLAY962SingleSelect1261 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1260 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.9.0 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.8.0.pre.alpha.play845allkitsbytypes1258 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.8.0.pre.alpha.play845allkitsbytypes1257 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.8.0.pre.alpha.PLAY962SingleSelect1256 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.8.0.pre.alpha.play845allkitsbytypes1255 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.8.0.pre.alpha.play845allkitsbytypes1254 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.8.0.pre.alpha.PLAY962SingleSelect1246 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.8.0.pre.alpha.PLAY1016reactionbuttonemojibug1245 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.8.0 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.7.0.pre.alpha.play845allkitsbytypes1234 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.7.0.pre.alpha.play845allkitsbytypes1232 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.7.0.pre.alpha.play845allkitsbytypes1231 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.7.0.pre.alpha.play978makehighchartsadevdependencypoc1223 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.6.0.pre.alpha.play845allkitsbytypes1219 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.7.0 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js