test('should localize start date', () => {
  I18nStubber.pushFrame()
  tz.changeLocale(french, 'fr_FR', 'fr')
  I18nStubber.setLocale('fr_FR')
  I18nStubber.stub('fr_FR', {
    'date.formats.full_with_weekday': '%a %-d %b %Y %-k:%M',
    'date.formats.medium_with_weekday': '%a %-d %b %Y',
    'date.formats.medium': '%-d %b %Y',
    'date.month_names': ['août'],
    'date.abbr_month_names': ['août']
  })
  const view = createView(commonEvent())
  equal(view.$('.date_field').val(), 'sam. 22 juil. 2017')
  I18nStubber.popFrame()
})
test('validates i18n mastery points', function() {
  const view = createView({
    model: this.outcome1,
    state: 'edit'
  })
  I18nStubber.pushFrame()
  I18nStubber.setLocale('fr_FR')
  I18nStubber.stub('fr_FR', {
    'number.format.delimiter': ' ',
    'number.format.separator': ','
  })
  view.$('input[name="mastery_points"]').val('1 234,5')
  ok(view.isValid())
  view.remove()
  I18nStubber.popFrame()
})
Example #3
0
import tz from 'timezone'
import i18nObj from 'i18nObj'
import detroit from 'timezone/America/Detroit'
import french from 'timezone/fr_FR'
import portuguese from 'timezone/pt_PT'
import chinese from 'timezone/zh_CN'
import I18nStubber from 'helpers/I18nStubber'
import trans from 'translations/_core_en'
import en_US from 'timezone/en_US'
import MockDate from 'mockdate'

QUnit.module('timezone', {
  setup() {
    this.snapshot = tz.snapshot()
    I18nStubber.pushFrame()
  },

  teardown() {
    tz.restore(this.snapshot)
    I18nStubber.popFrame()
  }
})

const moonwalk = new Date(Date.UTC(1969, 6, 21, 2, 56))
const epoch = new Date(Date.UTC(1970, 0, 1, 0, 0))

test('moment(one-arg) complains', () => {
  let err = null
  try {
    tz.moment('June 24 at 10:00pm')
  return (nonScreenreaderText = () => $.trim(this.view.$('.js-score .non-screenreader').text()))
}
const genTeardown = function() {
  fakeENV.teardown()
  $('#fixtures').empty()
}

QUnit.module('AssignmentListItemViewSpec', {
  setup() {
    fakeENV.setup({
      current_user_roles: ['teacher'],
      URLS: {assignment_sort_base_url: 'test'}
    })
    genSetup.call(this)
    this.snapshot = tz.snapshot()
    return I18nStubber.pushFrame()
  },
  teardown() {
    fakeENV.teardown()
    genTeardown.call(this)
    tz.restore(this.snapshot)
    return I18nStubber.popFrame()
  }
})

test('should be accessible', function(assert) {
  const view = createView(this.model, {canManage: true})
  const done = assert.async()
  assertions.isAccessible(view, done, {a11yReport: true})
})