-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
618bb23
commit c13e71a
Showing
3 changed files
with
81 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import '../identifier_position.dart'; | ||
import '../localedata.dart'; | ||
|
||
class LocalePtBr implements ILocaleData { | ||
String get seconds => 'alguns segundos'; | ||
|
||
String get aMinute => 'um minuto'; | ||
String get minutes => '%i minutos'; | ||
|
||
String get anHour => 'uma hora'; | ||
String get hours => '%i horas'; | ||
|
||
String get aDay => 'um dia'; | ||
String get days => '%i dias'; | ||
|
||
String get aMonth => 'um mês'; | ||
String get months => '%i meses'; | ||
|
||
String get aYear => 'um ano'; | ||
String get years => '%i anos'; | ||
|
||
String get futureIdentifier => 'em'; | ||
String get pastIdentifier => 'atrás'; | ||
|
||
IdentifierPosition get futurePosition => IdentifierPosition.prepend; | ||
IdentifierPosition get pastPosition => IdentifierPosition.append; | ||
} |
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 (c) 2016, rinukkusu. All rights reserved. Use of this source code | ||
// is governed by a BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:simple_moment/simple_moment.dart'; | ||
import 'package:simple_moment/src/locales/pt_br.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('Um grupo de testes', () { | ||
Moment.setLocaleGlobally(new LocalePtBr()); | ||
|
||
String dateString = "2016-12-31 02:33:01.565411"; | ||
DateTime date = DateTime.parse(dateString); | ||
|
||
DateTime currentDate = DateTime.parse("2016-12-31 12:00:00"); | ||
|
||
setUp(() {}); | ||
|
||
test('static Moment.parse', () { | ||
expect(Moment.parse(dateString).toString() == dateString, isTrue); | ||
}); | ||
|
||
test('new Moment.fromDate', () { | ||
expect(new Moment.fromDate(date).toString() == dateString, isTrue); | ||
}); | ||
|
||
test('Moment.from(futuro)', () { | ||
DateTime compareDate = DateTime.parse("2016-12-31 12:00:30"); | ||
expect( | ||
new Moment.fromDate(currentDate).from(compareDate) == | ||
"em alguns segundos", | ||
isTrue); | ||
}); | ||
|
||
test('Moment.from(passado)', () { | ||
DateTime compareDate = DateTime.parse("2016-12-31 11:59:30"); | ||
expect( | ||
new Moment.fromDate(currentDate).from(compareDate) == | ||
"alguns segundos atrás", | ||
isTrue); | ||
}); | ||
|
||
test('Moment.from(menos de um segundo atrás)', () { | ||
DateTime compareDate = DateTime.parse("2016-12-31 11:59:59.001"); | ||
expect( | ||
new Moment.fromDate(currentDate).from(compareDate) == | ||
"alguns segundos atrás", | ||
isTrue); | ||
}); | ||
}); | ||
} |