Skip to content

Commit 6c5f7b7

Browse files
[Language Detector] Add handling for empty expectedInputLanguages
Updates implementation and adds test to check that `detector.expectedInputLanguages` is `null` when an empty array is passed in. Spec: https://webmachinelearning.github.io/translation-api/#create-the-language-detector-object Bug: 414814251 Change-Id: Ibb9086c94ea02227eba8d1ead62747fcaa2a2c43 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6501483 Commit-Queue: Christine Hollingsworth <christinesm@chromium.org> Reviewed-by: Nathan Memmott <memmott@chromium.org> Cr-Commit-Position: refs/heads/main@{#1454662}
1 parent a21bc63 commit 6c5f7b7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

ai/language_detection/detector.https.window.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ promise_test(async t => {
184184
});
185185
}, 'Aborting LanguageDetector.measureInputUsage().');
186186

187+
promise_test(async () => {
188+
const detector = await createLanguageDetector({expectedInputLanguages: []});
189+
assert_equals(detector.expectedInputLanguages, null);
190+
}, 'Creating LanguageDetector with empty expectedInputLanguages array');
191+
187192
promise_test(async () => {
188193
const detector = await createLanguageDetector();
189194
assert_equals(detector.expectedInputLanguages, null);

0 commit comments

Comments
 (0)