This commit is contained in:
Nicolas Gallagher
2015-09-20 21:00:15 -07:00
parent ec9985a3b3
commit 39b273f9d8
3 changed files with 13 additions and 20 deletions

View File

@@ -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"', () => { })

View File

@@ -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()
}

View File

@@ -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()