forked from oppia/oppia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added config for featured language * styling * added get endpoint * frontend backend service + tests * styling; codeowners * sort inputs * sorted imports * Styling * formatting * basic component setup * fixed linting * new selector completed * styling * EtE tests * Added E2E test for switching languages * e2e * removed usused code * tests are failing * a few tests * finished tests * relative reference exception * relative reference exception * relative reference exception * linting * linting * linting * linter * Addressed comments * cleaned up code * styling * increased coverage by fixing async tests [skip ci] * [skip ci] cleaned up code * async/await for backend * try catch * [skip ci] removed unnecessary try catch wrap * let => const * fixed e2e test, backend lint, typescript eror * Addressed review comments * added validator * fixed test * fixed e2e test * addressed review comments * Styling * styling * html styling * fixed relative import * fixed import * typos * review comments * syntax * syntax * tests * styling * remove fit * review * doc string * test * conf * fixed frontend tests * fixed test * styling * fixed test * Update core/templates/pages/community-dashboard-page/translation-language-selector/translation-language-selector.component.spec.ts Co-authored-by: Mariana Zangrossi <[email protected]> * async try catch * styling Co-authored-by: shavavo <[email protected]> Co-authored-by: Mariana Zangrossi <[email protected]>
- Loading branch information
1 parent
1ee6ceb
commit 165c637
Showing
22 changed files
with
811 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
core/templates/domain/opportunity/FeaturedTranslationLanguageObjectFactory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2020 The Oppia Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS-IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/** | ||
* @fileoverview Factory for creating and mutating instances of frontend | ||
* featured translation language domain objects. | ||
*/ | ||
|
||
import { downgradeInjectable } from '@angular/upgrade/static'; | ||
import { Injectable } from '@angular/core'; | ||
|
||
export interface IFeaturedTranslationLanguageBackendDict { | ||
'language_code': string; | ||
explanation: string; | ||
} | ||
|
||
export class FeaturedTranslationLanguage { | ||
constructor( | ||
readonly languageCode: string, | ||
readonly explanation: string | ||
) {} | ||
} | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class FeaturedTranslationLanguageObjectFactory { | ||
createFromBackendDict( | ||
featuredTranslationBackendDict: IFeaturedTranslationLanguageBackendDict | ||
): FeaturedTranslationLanguage { | ||
return new FeaturedTranslationLanguage( | ||
featuredTranslationBackendDict.language_code, | ||
featuredTranslationBackendDict.explanation | ||
); | ||
} | ||
} | ||
|
||
angular.module('oppia').factory( | ||
'FeaturedTranslationLanguageObjectFactory', | ||
downgradeInjectable(FeaturedTranslationLanguageObjectFactory)); |
50 changes: 50 additions & 0 deletions
50
core/templates/domain/opportunity/featured-translation-language-object.factory.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2020 The Oppia Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS-IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/** | ||
* @fileoverview Tests for FeaturedTranslationLanguageObjectFactory. | ||
*/ | ||
|
||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { | ||
FeaturedTranslationLanguageObjectFactory, | ||
FeaturedTranslationLanguage, | ||
IFeaturedTranslationLanguageBackendDict | ||
} from | ||
'domain/opportunity/FeaturedTranslationLanguageObjectFactory'; | ||
|
||
describe('Featured Translation Language object factory', () => { | ||
let featuredTranslationLanguageObjectFactory: | ||
FeaturedTranslationLanguageObjectFactory = null; | ||
let sampleFTL: FeaturedTranslationLanguage = null; | ||
|
||
beforeEach(() => { | ||
featuredTranslationLanguageObjectFactory = TestBed.get( | ||
FeaturedTranslationLanguageObjectFactory); | ||
|
||
let sampleFTLDict: IFeaturedTranslationLanguageBackendDict = { | ||
language_code: 'en', | ||
explanation: 'English' | ||
}; | ||
sampleFTL = featuredTranslationLanguageObjectFactory | ||
.createFromBackendDict(sampleFTLDict); | ||
}); | ||
|
||
it('should correctly evaluate all the values based on backend' + | ||
' dict', function() { | ||
expect(sampleFTL.languageCode).toBe('en'); | ||
expect(sampleFTL.explanation).toBe('English'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.