Sha256: ae00c10ea536ac1520b2466b47067009976720408e9e8cb4618529c9a488b58f

Contents?: true

Size: 1.26 KB

Versions: 463

Compression:

Stored size: 1.26 KB

Contents

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

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

463 entries across 463 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5437 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.PBNTR719listdraggablesimple5432 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.PBNTR768stickyrightcolumn5431 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.12.0.pre.rc.6 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5415 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5413 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.12.0.pre.rc.5 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5409 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5400 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5392 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js