-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #329 from cocopon/number-monitor-format
Add `format` to number monitor
- Loading branch information
Showing
3 changed files
with
47 additions
and
10 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,29 @@ | ||
import * as assert from 'assert'; | ||
import {describe} from 'mocha'; | ||
|
||
import {MonitorBindingController} from '../../blade/monitor-binding/controller/monitor-binding'; | ||
import {BindingTarget} from '../../common/binding/target'; | ||
import {createTestWindow} from '../../misc/dom-test-util'; | ||
import {SingleLogController} from '../common/controller/single-log'; | ||
import {createMonitorBindingController} from '../plugin'; | ||
import {NumberMonitorPlugin} from './plugin'; | ||
|
||
describe(NumberMonitorPlugin.id, () => { | ||
it('should apply `format`', () => { | ||
const doc = createTestWindow().document; | ||
const obj = { | ||
foo: 1, | ||
}; | ||
const bc = createMonitorBindingController(NumberMonitorPlugin, { | ||
document: doc, | ||
params: { | ||
format: () => 'formatted', | ||
interval: 0, | ||
}, | ||
target: new BindingTarget(obj, 'foo'), | ||
}) as MonitorBindingController<number>; | ||
|
||
const c = bc.valueController as SingleLogController<number>; | ||
assert.strictEqual(c.view.inputElement.value, 'formatted'); | ||
}); | ||
}); |
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