Sha256: 81b4c888ab1aa45ef3694d7fdc510327f64b2cf2b6531ca684db9eaef215a1c9

Contents?: true

Size: 1.97 KB

Versions: 19

Compression:

Stored size: 1.97 KB

Contents

import { module, test } from '../qunit';
import moment from '../../moment';

module('normalize units');

test('normalize units', function (assert) {
    var fullKeys = [
            'year',
            'quarter',
            'month',
            'isoWeek',
            'week',
            'day',
            'hour',
            'minute',
            'second',
            'millisecond',
            'date',
            'dayOfYear',
            'weekday',
            'isoWeekday',
            'weekYear',
            'isoWeekYear',
        ],
        aliases = [
            'y',
            'Q',
            'M',
            'W',
            'w',
            'd',
            'h',
            'm',
            's',
            'ms',
            'D',
            'DDD',
            'e',
            'E',
            'gg',
            'GG',
        ],
        length = fullKeys.length,
        fullKey,
        fullKeyCaps,
        fullKeyPlural,
        fullKeyCapsPlural,
        alias,
        index;

    for (index = 0; index < length; index += 1) {
        fullKey = fullKeys[index];
        fullKeyCaps = fullKey.toUpperCase();
        fullKeyPlural = fullKey + 's';
        fullKeyCapsPlural = fullKeyCaps + 's';
        alias = aliases[index];
        assert.equal(
            moment.normalizeUnits(fullKey),
            fullKey,
            'Testing full key ' + fullKey
        );
        assert.equal(
            moment.normalizeUnits(fullKeyCaps),
            fullKey,
            'Testing full key capitalised ' + fullKey
        );
        assert.equal(
            moment.normalizeUnits(fullKeyPlural),
            fullKey,
            'Testing full key plural ' + fullKey
        );
        assert.equal(
            moment.normalizeUnits(fullKeyCapsPlural),
            fullKey,
            'Testing full key capitalised and plural ' + fullKey
        );
        assert.equal(
            moment.normalizeUnits(alias),
            fullKey,
            'Testing alias ' + fullKey
        );
    }
});

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
card-mod-date-0.15.6 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.15.0 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.14.2 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.14.1 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.14.0 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.13.4 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.13.3 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.13.2 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.13.1 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.13.0 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.11.7 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.12.0 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.11.6 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.11.5 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.11.4 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.11.3 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.11.2 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.11.1 vendor/moment/src/test/moment/normalize_units.js
card-mod-date-0.11.0 vendor/moment/src/test/moment/normalize_units.js