Files
vault/ui/tests/integration/helpers/date-format-test.js
Angel Garbarino bcdff2e1a8 UI/obscure secret on input (#11284)
* new font and add as font-family to be used in masked-input

* clean up logic

* refactor for displayOnly

* start cert masking

* work on certificates

* upload cert work

* fix global styling

* fix styling for class no longer used

* make mask by default and remove option

* glimmerize start and certificate on LDAP a file field

* glimmerize actions

* first part of glimmerizing text-file still need to do some clean up

* not doing awesome over here

* getting ready to un-glimmer

* unglimmerize

* remove placeholder based on conversations with design

* clean up text-file

* cleanup

* fix class bindings

* handle class binding

* set up for test

* fix elementId

* track down index

* update masked-input test

* add more to the masked-input test

* test-file test

* fix broken test

* clear old style

* clean up

* remove pgp key masked font, this really needs to be refactored to text-file component

* changelog

* cover other certificate view

* add allowCopy

* address some pr styling comments

* improve test coverage

* fix some issues

* add attr.options.masked
2021-04-22 08:58:37 -06:00

46 lines
1.7 KiB
JavaScript

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Helper | date-format', function(hooks) {
setupRenderingTest(hooks);
test('it is able to format a date object', async function(assert) {
let today = new Date();
this.set('today', today);
await render(hbs`<p data-test-date-format>Date: {{date-format today "yyyy"}}</p>`);
assert
.dom('[data-test-date-format]')
.includesText(today.getFullYear(), 'it renders the date in the year format');
});
test('it supports date timestamps', async function(assert) {
let today = new Date().getTime();
this.set('today', today);
await render(hbs`<p class="date-format">{{date-format today 'hh:mm:ss'}}</p>`);
let formattedDate = document.querySelector('.date-format').innerText;
assert.ok(formattedDate.match(/^\d{2}:\d{2}:\d{2}$/));
});
test('it supports date strings', async function(assert) {
let todayString = new Date().getFullYear().toString();
this.set('todayString', todayString);
await render(hbs`<p data-test-date-format>Date: {{date-format todayString "yyyy"}}</p>`);
assert
.dom('[data-test-date-format]')
.includesText(todayString, 'it renders the a date if passed in as a string');
});
test('it supports ten digit dates', async function(assert) {
let tenDigitDate = 1621785298;
this.set('tenDigitDate', tenDigitDate);
await render(hbs`<p data-test-date-format>Date: {{date-format tenDigitDate "MM/dd/yyyy"}}</p>`);
assert.dom('[data-test-date-format]').includesText('05/23/2021');
});
});