@@ -110,6 +110,7 @@ describe('State translation component', () => {
110
110
let outcomeObjectFactory : OutcomeObjectFactory ;
111
111
let stateEditorService : StateEditorService ;
112
112
let stateRecordedVoiceoversService : StateRecordedVoiceoversService ;
113
+ let subtitledUnicodeObjectFactory : SubtitledUnicodeObjectFactory ;
113
114
let translationLanguageService : TranslationLanguageService ;
114
115
let translationTabActiveContentIdService :
115
116
TranslationTabActiveContentIdService ;
@@ -314,6 +315,8 @@ describe('State translation component', () => {
314
315
explorationStatesService = TestBed . inject ( ExplorationStatesService ) ;
315
316
stateRecordedVoiceoversService = TestBed . inject (
316
317
StateRecordedVoiceoversService ) ;
318
+ subtitledUnicodeObjectFactory = TestBed . inject (
319
+ SubtitledUnicodeObjectFactory ) ;
317
320
translationLanguageService = TestBed . inject ( TranslationLanguageService ) ;
318
321
translationTabActiveContentIdService = TestBed . inject (
319
322
TranslationTabActiveContentIdService ) ;
@@ -605,6 +608,18 @@ describe('State translation component', () => {
605
608
'This is the html' ) ;
606
609
} ) ;
607
610
611
+ it ( 'should get subtitled Unicode data translation' , ( ) => {
612
+ let subtitledObject = subtitledUnicodeObjectFactory . createFromBackendDict (
613
+ {
614
+ content_id : 'content_1' ,
615
+ unicode_str : 'This is the unicode'
616
+ } ) ;
617
+ expect ( component . getRequiredUnicode ( subtitledObject ) ) . toBe (
618
+ 'This is the unicode' ) ;
619
+ expect ( component . getSubtitledContentSummary ( subtitledObject ) ) . toBe (
620
+ 'This is the unicode' ) ;
621
+ } ) ;
622
+
608
623
it ( 'should get empty content message when text translations haven\'t' +
609
624
' been added yet' , ( ) => {
610
625
expect ( component . getEmptyContentMessage ( ) ) . toBe (
@@ -1048,6 +1063,7 @@ describe('State translation component', () => {
1048
1063
let explorationStatesService : ExplorationStatesService ;
1049
1064
let stateEditorService : StateEditorService ;
1050
1065
let stateRecordedVoiceoversService : StateRecordedVoiceoversService ;
1066
+ let subtitledUnicodeObjectFactory : SubtitledUnicodeObjectFactory ;
1051
1067
let translationLanguageService : TranslationLanguageService ;
1052
1068
let translationTabActiveContentIdService :
1053
1069
TranslationTabActiveContentIdService ;
@@ -1312,6 +1328,8 @@ describe('State translation component', () => {
1312
1328
explorationStatesService = TestBed . inject ( ExplorationStatesService ) ;
1313
1329
stateRecordedVoiceoversService = TestBed . inject (
1314
1330
StateRecordedVoiceoversService ) ;
1331
+ subtitledUnicodeObjectFactory = TestBed . inject (
1332
+ SubtitledUnicodeObjectFactory ) ;
1315
1333
translationLanguageService = TestBed . inject ( TranslationLanguageService ) ;
1316
1334
translationTabActiveContentIdService = TestBed . inject (
1317
1335
TranslationTabActiveContentIdService ) ;
@@ -1444,6 +1462,17 @@ describe('State translation component', () => {
1444
1462
expect ( htmlData ) . toBe ( '<p>HTML data</p>' ) ;
1445
1463
} ) ;
1446
1464
1465
+ it ( 'should return unicode when translation tab is active' , ( ) => {
1466
+ spyOn ( translationTabActiveModeService , 'isTranslationModeActive' ) . and
1467
+ . returnValue ( true ) ;
1468
+ let subtitledObject = subtitledUnicodeObjectFactory . createFromBackendDict ( {
1469
+ content_id : 'content_1' ,
1470
+ unicode_str : 'This is the unicode'
1471
+ } ) ;
1472
+ const unicodeData = component . getRequiredUnicode ( subtitledObject ) ;
1473
+ expect ( unicodeData ) . toBe ( 'This is the unicode' ) ;
1474
+ } ) ;
1475
+
1447
1476
it ( 'should return translation html when translation available' , ( ) => {
1448
1477
entityTranslationsService . languageCodeToEntityTranslations . en = (
1449
1478
new EntityTranslation (
@@ -1458,6 +1487,24 @@ describe('State translation component', () => {
1458
1487
expect ( htmlData ) . toBe ( 'Translated HTML' ) ;
1459
1488
} ) ;
1460
1489
1490
+ it ( 'should return unicode when translation is empty in voiceover mode' , ( ) => {
1491
+ entityTranslationsService . languageCodeToEntityTranslations . en = (
1492
+ new EntityTranslation (
1493
+ 'entityId' , 'entityType' , 'entityVersion' , 'hi' , {
1494
+ content_0 : new TranslatedContent
1495
+ (
1496
+ 'Translated unicode' , 'unicode' , true
1497
+ )
1498
+ } )
1499
+ ) ;
1500
+ let subtitledObject = subtitledUnicodeObjectFactory . createFromBackendDict ( {
1501
+ content_id : 'content_1' ,
1502
+ unicode_str : 'This is the unicode'
1503
+ } ) ;
1504
+ const unicodeData = component . getRequiredUnicode ( subtitledObject ) ;
1505
+ expect ( unicodeData ) . toBe ( 'This is the unicode' ) ;
1506
+ } ) ;
1507
+
1461
1508
it ( 'should return translation html when translation no available' , ( ) => {
1462
1509
entityTranslationsService . languageCodeToEntityTranslations . en = (
1463
1510
new EntityTranslation (
@@ -1472,6 +1519,30 @@ describe('State translation component', () => {
1472
1519
expect ( htmlData ) . toBe ( '<p>HTML data</p>' ) ;
1473
1520
} ) ;
1474
1521
1522
+ it ( 'should return translated unicode in voiceover mode when translation exist'
1523
+ , ( ) => {
1524
+ entityTranslationsService . languageCodeToEntityTranslations . en = (
1525
+ new EntityTranslation (
1526
+ 'entityId' ,
1527
+ 'entityType' ,
1528
+ 'entityVersion' ,
1529
+ 'hi' ,
1530
+ {
1531
+ content_1 : new TranslatedContent
1532
+ (
1533
+ 'Translated UNICODE' , 'unicode' , true
1534
+ )
1535
+ } )
1536
+ ) ;
1537
+ let subtitledObject = subtitledUnicodeObjectFactory . createFromBackendDict (
1538
+ {
1539
+ content_id : 'content_1' ,
1540
+ unicode_str : 'This is the unicode'
1541
+ } ) ;
1542
+ const unicodeData = component . getRequiredUnicode ( subtitledObject ) ;
1543
+ expect ( unicodeData ) . toBe ( 'Translated UNICODE' ) ;
1544
+ } ) ;
1545
+
1475
1546
describe ( 'when rules input tab is accessed but with no rules' , ( ) => {
1476
1547
it ( 'should throw an error when there are no rules' , ( ) => {
1477
1548
spyOn ( component , 'isDisabled' ) . and . returnValue ( false ) ;
0 commit comments