mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: timer field (#5349)
* feat: wip timer field * feat: timer field fixing errors * feat: wip timer field frontend * fix: parsing TimerCellDataPB * feat: parse time string to minutes * fix: don't allow none number input * fix: timer filter * style: cargo fmt * fix: clippy errors * refactor: rename field type timer to time * refactor: missed some variable and files to rename * style: cargo fmt fix * feat: format time field type data in frontend * style: fix cargo fmt * fix: fixes after merge --------- Co-authored-by: Mathias Mogensen <mathiasrieckm@gmail.com>
This commit is contained in:
committed by
GitHub
parent
2d4300e931
commit
aa621a8d84
24
frontend/appflowy_flutter/test/unit_test/util/time.dart
Normal file
24
frontend/appflowy_flutter/test/unit_test/util/time.dart
Normal file
@ -0,0 +1,24 @@
|
||||
import 'package:appflowy/util/time.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
test('parseTime should parse time string to minutes', () {
|
||||
expect(parseTime('10'), 10);
|
||||
expect(parseTime('70m'), 70);
|
||||
expect(parseTime('4h 20m'), 260);
|
||||
expect(parseTime('1h 80m'), 140);
|
||||
expect(parseTime('asffsa2h3m'), null);
|
||||
expect(parseTime('2h3m'), null);
|
||||
expect(parseTime('blah'), null);
|
||||
expect(parseTime('10a'), null);
|
||||
expect(parseTime('2h'), 120);
|
||||
});
|
||||
|
||||
test('formatTime should format time minutes to formatted string', () {
|
||||
expect(formatTime(5), "5m");
|
||||
expect(formatTime(75), "1h 15m");
|
||||
expect(formatTime(120), "2h");
|
||||
expect(formatTime(-50), "");
|
||||
expect(formatTime(0), "0m");
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user