Browse Source

Tests fixed

pull/1/head
Sebastian 9 years ago
parent
commit
932e0ad105
  1. 14
      src/Squidex/app/framework/angular/date-time.pipes.spec.ts
  2. 8
      src/Squidex/app/framework/angular/money.pipe.spec.ts
  3. 6
      src/Squidex/app/framework/utils/date-time.spec.ts
  4. 4
      src/Squidex/app/framework/utils/date-time.ts
  5. 2
      src/Squidex/app/theme/_mixins.scss

14
src/Squidex/app/framework/angular/date-time.pipes.spec.ts

@ -25,7 +25,7 @@ describe('DurationPipe', () => {
const pipe = new DurationPipe();
const actual = pipe.transform(duration, []);
const actual = pipe.transform(duration);
const expected = '312:10h';
expect(actual).toBe(expected);
@ -36,7 +36,7 @@ describe('DayPipe', () => {
it('should format to day numbers', () => {
const pipe = new DayPipe();
const actual = pipe.transform(dateTime, []);
const actual = pipe.transform(dateTime);
const expected = '03';
expect(actual).toBe(expected);
@ -47,7 +47,7 @@ describe('MonthPipe', () => {
it('should format to long month name', () => {
const pipe = new MonthPipe();
const actual = pipe.transform(dateTime, []);
const actual = pipe.transform(dateTime);
const expected = 'October';
expect(actual).toBe(expected);
@ -58,7 +58,7 @@ describe('FromNowPipe', () => {
it('should format to from now string', () => {
const pipe = new FromNowPipe();
const actual = pipe.transform(DateTime.now().addMinutes(-4), []);
const actual = pipe.transform(DateTime.now().addMinutes(-4));
const expected = '4 minutes ago';
expect(actual).toBe(expected);
@ -69,7 +69,7 @@ describe('DayOfWeekPipe', () => {
it('should format to short week of day string', () => {
const pipe = new DayOfWeekPipe();
const actual = pipe.transform(dateTime, []);
const actual = pipe.transform(dateTime);
const expected = 'Th';
expect(actual).toBe(expected);
@ -80,7 +80,7 @@ describe('ShortDatePipe', () => {
it('should format to two digit day number and short month name', () => {
const pipe = new ShortDatePipe();
const actual = pipe.transform(dateTime, []);
const actual = pipe.transform(dateTime);
const expected = '03.Oct';
expect(actual).toBe(expected);
@ -91,7 +91,7 @@ describe('ShortTimePipe', () => {
it('should format to short time string', () => {
const pipe = new ShortTimePipe();
const actual = pipe.transform(dateTime, []);
const actual = pipe.transform(dateTime);
const expected = '12:13';
expect(actual).toBe(expected);

8
src/Squidex/app/framework/angular/money.pipe.spec.ts

@ -13,7 +13,7 @@ describe('MoneyPipe', () => {
it('should format money values with symbol after number', () => {
const pipe = new MoneyPipe(new CurrencyConfig('EUR', '€'), new DecimalSeparatorConfig(','));
const actual = pipe.transform(123.49, []);
const actual = pipe.transform(123.49);
const expected = '123,<span class="decimal">49</span> €';
expect(actual).toBe(expected);
@ -22,7 +22,7 @@ describe('MoneyPipe', () => {
it('should format money values with symbol after number and one decimal', () => {
const pipe = new MoneyPipe(new CurrencyConfig('EUR', '€'), new DecimalSeparatorConfig(','));
const actual = pipe.transform(123.4, []);
const actual = pipe.transform(123.4);
const expected = '123,<span class="decimal">40</span> €';
expect(actual).toBe(expected);
@ -31,7 +31,7 @@ describe('MoneyPipe', () => {
it('should format money values with symbol before number', () => {
const pipe = new MoneyPipe(new CurrencyConfig('EUR', '€', false), new DecimalSeparatorConfig(','));
const actual = pipe.transform(123.49, []);
const actual = pipe.transform(123.49);
const expected = '€ 123,<span class="decimal">49</span>';
expect(actual).toBe(expected);
@ -40,7 +40,7 @@ describe('MoneyPipe', () => {
it('should format money values with symbol before number and one decimal', () => {
const pipe = new MoneyPipe(new CurrencyConfig('EUR', '€', false), new DecimalSeparatorConfig(','));
const actual = pipe.transform(123.4, []);
const actual = pipe.transform(123.4);
const expected = '€ 123,<span class="decimal">40</span>';
expect(actual).toBe(expected);

6
src/Squidex/app/framework/utils/date-time.spec.ts

@ -81,12 +81,6 @@ describe('DateTime', () => {
expect(actual).toEqual(expected);
});
it('should convert to local time', () => {
const value = DateTime.parseISO_UTC('2013-10-16T12:13:14');
expect(value.toLocal().ne(value)).toBeTruthy();
});
it('should print to formatted string', () => {
const value = DateTime.parseISO_UTC('2013-10-16T12:13:14');
const actual = value.toStringFormat('hh:mm');

4
src/Squidex/app/framework/utils/date-time.ts

@ -221,10 +221,6 @@ export class DateTime {
return new DateTime(clone);
}
public toLocal(): DateTime {
return new DateTime(new Date(this.value.getTime() - this.value.getTimezoneOffset() * 60 * 1000));
}
public toUTCString(): string {
return this.value.toUTCString();
}

2
src/Squidex/app/theme/_mixins.scss

@ -94,7 +94,7 @@
@mixin circle($size) {
@include border-radius($size * .5);
width: $size;
width: $size;
height: $size;
}

Loading…
Cancel
Save