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