-
Notifications
You must be signed in to change notification settings - Fork 277
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
hanxujiang
committed
Aug 17, 2022
1 parent
6660e46
commit 3440acb
Showing
2 changed files
with
29 additions
and
0 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,28 @@ | ||
import simulate from 'miniprogram-simulate'; | ||
import path from 'path'; | ||
|
||
describe('result', () => { | ||
const result = simulate.load(path.resolve(__dirname, `../result`), { | ||
less: true, | ||
rootPath: path.resolve(__dirname, '../..'), | ||
}); | ||
|
||
it(':props', () => { | ||
const id = simulate.load({ | ||
template: `<t-result class="result" title="{{title}}" theme="{{theme}}" description="{{description}}"></t-result>`, | ||
data: { | ||
description: 'This is a description', | ||
}, | ||
usingComponents: { | ||
't-result': result, | ||
}, | ||
}); | ||
const comp = simulate.render(id); | ||
comp.attach(document.createElement('parent-wrapper')); | ||
expect(comp.querySelector('.result').data.description).toBe('This is a description'); | ||
comp.setData({ theme: 'success' }); | ||
expect(comp.querySelector('.result').data.theme).toBe('success'); | ||
comp.setData({ title: 'This is title' }); | ||
expect(comp.querySelector('.result').data.title).toBe('This is title'); | ||
}); | ||
}); |