mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-10 19:52:53 +00:00
fix: translator can now handle enum translations
This commit is contained in:
@@ -18,6 +18,7 @@ import {slow, suite, test, timeout} from 'mocha-typescript';
|
||||
import {SCThingOriginType, SCThingType} from '../src/things/abstract/thing';
|
||||
import {SCBuildingWithoutReferences} from '../src/things/building';
|
||||
import {SCDish, SCDishMeta} from '../src/things/dish';
|
||||
import {SCSetting, SCSettingInputType} from '../src/things/setting';
|
||||
import {SCThingTranslator} from '../src/translator';
|
||||
|
||||
const building: SCBuildingWithoutReferences = {
|
||||
@@ -86,6 +87,23 @@ const dish: SCDish = {
|
||||
uid: '540862f3-ea30-5b8f-8678-56b4dc217140',
|
||||
};
|
||||
|
||||
const setting: SCSetting = {
|
||||
categories: ['profile'],
|
||||
defaultValue: 'student',
|
||||
description: 'base-description',
|
||||
inputType: SCSettingInputType.SingleChoice,
|
||||
name: 'group',
|
||||
order: 1,
|
||||
origin: {
|
||||
indexed: '2018-11-11T14:30:00Z',
|
||||
name: 'Dummy',
|
||||
type: SCThingOriginType.Remote,
|
||||
},
|
||||
type: SCThingType.Setting,
|
||||
uid: '2c97aa36-4aa2-43de-bc5d-a2b2cb3a530e',
|
||||
values: ['student', 'employee', true, 42],
|
||||
};
|
||||
|
||||
const translator = new SCThingTranslator('de');
|
||||
// tslint:disable-next-line:no-eval
|
||||
const languageNonExistant = eval("'jp'");
|
||||
@@ -95,6 +113,10 @@ const translatorWithFallback = new SCThingTranslator(languageNonExistant);
|
||||
// tslint:disable:member-ordering TranslationSpecInplace
|
||||
@suite(timeout(10000), slow(5000))
|
||||
export class TranslationSpecInplace {
|
||||
@test
|
||||
public directEnumSingleValue () {
|
||||
expect(translator.translate(setting).inputType()).to.equal('einfache Auswahl');
|
||||
}
|
||||
|
||||
@test
|
||||
public directStringLiteralType() {
|
||||
|
||||
Reference in New Issue
Block a user