mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-01-12 22:51:09 +08:00
Moves
This commit is contained in:
@@ -29,30 +29,26 @@ suite('Image', () => {
|
||||
|
||||
test('prop "onError"', function (done) {
|
||||
this.timeout(5000)
|
||||
|
||||
function onError(e) {
|
||||
assert.equal(e.nativeEvent.type, 'error')
|
||||
done()
|
||||
}
|
||||
|
||||
render(<Image
|
||||
onError={onError}
|
||||
source={{ uri: 'https://google.com/favicon.icox' }}
|
||||
/>)
|
||||
function onError(e) {
|
||||
assert.equal(e.nativeEvent.type, 'error')
|
||||
done()
|
||||
}
|
||||
})
|
||||
|
||||
test('prop "onLoad"', function (done) {
|
||||
this.timeout(5000)
|
||||
|
||||
function onLoad(e) {
|
||||
assert.equal(e.nativeEvent.type, 'load')
|
||||
done()
|
||||
}
|
||||
|
||||
render(<Image
|
||||
onLoad={onLoad}
|
||||
source={{ uri: 'https://google.com/favicon.ico' }}
|
||||
/>)
|
||||
function onLoad(e) {
|
||||
assert.equal(e.nativeEvent.type, 'load')
|
||||
done()
|
||||
}
|
||||
})
|
||||
|
||||
test.skip('prop "onLoadEnd"', () => { })
|
||||
|
||||
@@ -18,7 +18,6 @@ suite('Text', () => {
|
||||
test('prop "children"', () => {
|
||||
const children = 'children'
|
||||
const result = shallowRender(<Text>{children}</Text>)
|
||||
|
||||
assert.equal(result.props.children, children)
|
||||
})
|
||||
|
||||
@@ -31,9 +30,7 @@ suite('Text', () => {
|
||||
test('prop "onPress"', (done) => {
|
||||
const dom = renderToDOM(<Text onPress={onPress} />)
|
||||
ReactTestUtils.Simulate.click(dom)
|
||||
|
||||
function onPress(e) {
|
||||
assert(true, 'the "onPress" callback was never called')
|
||||
assert.ok(e.nativeEvent)
|
||||
done()
|
||||
}
|
||||
|
||||
@@ -84,11 +84,6 @@ export function render(element, container) {
|
||||
: ReactTestUtils.renderIntoDocument(element)
|
||||
}
|
||||
|
||||
export function renderToDOM(element, container) {
|
||||
const result = render(element, container)
|
||||
return React.findDOMNode(result)
|
||||
}
|
||||
|
||||
export function renderAndInject(element) {
|
||||
const id = '_renderAndInject'
|
||||
let div = document.getElementById(id)
|
||||
@@ -105,6 +100,11 @@ export function renderAndInject(element) {
|
||||
return React.findDOMNode(result)
|
||||
}
|
||||
|
||||
export function renderToDOM(element, container) {
|
||||
const result = render(element, container)
|
||||
return React.findDOMNode(result)
|
||||
}
|
||||
|
||||
export function requiresFocus(test, fallback) {
|
||||
if (document.hasFocus && document.hasFocus()) {
|
||||
test()
|
||||
|
||||
Reference in New Issue
Block a user