Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: packages/intl/test/find_default_locale_browser_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 @TestOn("browser")
5 library find_default_locale_browser_test; 6 library find_default_locale_browser_test;
6 7
7 import 'package:intl/intl.dart'; 8 import 'package:intl/intl.dart';
8 import 'package:intl/intl_browser.dart'; 9 import 'package:intl/intl_browser.dart';
9 import 'package:unittest/unittest.dart'; 10 import 'package:test/test.dart';
10 11
11 main() { 12 main() {
12 test("Find system locale in browser", () { 13 test("Find system locale in browser", () {
13 // TODO (alanknight): This only verifies that we found some locale. We 14 // TODO (alanknight): This only verifies that we found some locale. We
14 // should find a way to force the system locale before the test is run 15 // should find a way to force the system locale before the test is run
15 // and then verify that it's actually the correct value. 16 // and then verify that it's actually the correct value.
16 Intl.systemLocale = 'xx_YY'; 17 Intl.systemLocale = 'xx_YY';
17 var callback = expectAsync(verifyLocale); 18 ThenArgument callback = expectAsync(verifyLocale) as ThenArgument;
18 findSystemLocale().then(callback); 19 findSystemLocale().then(callback);
19 }); 20 });
20 } 21 }
21 22
23 typedef ThenArgument(String _);
24
22 verifyLocale(_) { 25 verifyLocale(_) {
23 expect(Intl.systemLocale, isNot(equals("xx_YY"))); 26 expect(Intl.systemLocale, isNot(equals("xx_YY")));
24 // Allow either en_US or just en type locales. Windows in particular may 27 // Allow either en_US or just en type locales. Windows in particular may
25 // give us just ru for ru_RU 28 // give us just ru for ru_RU
26 var pattern = new RegExp(r"\w\w_[A-Z0-9]+"); 29 var pattern = new RegExp(r"\w\w_[A-Z0-9]+");
27 var shortPattern = new RegExp(r"\w\w"); 30 var shortPattern = new RegExp(r"\w\w");
28 var match = pattern.hasMatch(Intl.systemLocale); 31 var match = pattern.hasMatch(Intl.systemLocale);
29 var shortMatch = shortPattern.hasMatch(Intl.systemLocale); 32 var shortMatch = shortPattern.hasMatch(Intl.systemLocale);
30 expect(match || shortMatch, isTrue); 33 expect(match || shortMatch, isTrue);
31 } 34 }
OLDNEW
« no previous file with comments | « packages/intl/test/date_time_strict_test.dart ('k') | packages/intl/test/find_default_locale_standalone_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698