Sha256: 89cd90ee1b14bd33564ab0980ab14a5436ef4f62a95519509c377bc13c7574b2

Contents?: true

Size: 1.32 KB

Versions: 19

Compression:

Stored size: 1.32 KB

Contents

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

/* 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

19 entries across 19 versions & 1 rubygems

Version Path
playbook_ui-13.34.0.pre.alpha.PLAY14143373 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.34.0.pre.alpha.PLAY14143372 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.34.0.pre.alpha.PLAY14143358 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.34.0.pre.alpha.PLAY14143357 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.33.1.pre.alpha.PLAY14143340 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.33.1.pre.alpha.PLAY14143336 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.33.0.pre.alpha.PLAY14143318 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.33.0.pre.alpha.PLAY14143312 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.33.0.pre.alpha.PLAY14143306 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.33.0.pre.alpha.PLAY14143305 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.32.0.pre.alpha.PLAY14143297 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.32.0.pre.alpha.PLAY14143288 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.32.0.pre.alpha.PLAY14143272 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.32.0.pre.alpha.PLAY14143271 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.32.0.pre.alpha.PLAY14143267 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.32.0.pre.alpha.PLAY14143264 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.32.0.pre.alpha.PLAY14143260 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.32.0.pre.alpha.PLAY14143255 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
playbook_ui-13.32.0.pre.alpha.PLAY14143251 app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js