-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move examples, delete old files and add basic testing example
- Loading branch information
Showing
75 changed files
with
98 additions
and
231 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,23 @@ | ||
import React from 'react'; | ||
import TestUtils from 'react/lib/ReactTestUtils'; | ||
import wrapInTestContext from '../../shared/wrapInTestContext'; | ||
import expect from 'expect'; | ||
import Box from '../Box'; | ||
|
||
describe('Box', () => { | ||
it('changes opacity when dragged', () => { | ||
const BoxContext = wrapInTestContext(Box); | ||
|
||
const root = TestUtils.renderIntoDocument(<BoxContext name='test' />); | ||
const backend = root.getManager().getBackend(); | ||
|
||
let div = TestUtils.findRenderedDOMComponentWithTag(root, 'div'); | ||
expect(div.props.style.opacity).toEqual(1); | ||
|
||
const box = TestUtils.findRenderedComponentWithType(root, Box); | ||
backend.simulateBeginDrag([box.getHandlerId()]); | ||
|
||
div = TestUtils.findRenderedDOMComponentWithTag(root, 'div'); | ||
expect(div.props.style.opacity).toEqual(0.4); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,14 @@ | ||
import React, { Component } from 'react'; | ||
import { createTestBackend } from 'dnd-core'; | ||
import { DragDropContext } from 'react-dnd'; | ||
|
||
export default function wrapInTestContext(DecoratedComponent) { | ||
@DragDropContext(createTestBackend) | ||
class TestStub extends Component { | ||
render() { | ||
return <DecoratedComponent {...this.props} />; | ||
} | ||
} | ||
|
||
return TestStub; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,33 @@ | ||
var path = require('path'); | ||
|
||
module.exports = function (config) { | ||
config.set({ | ||
browsers: ['Chrome'], | ||
singleRun: true, | ||
frameworks: ['mocha'], | ||
files: [ | ||
'tests.webpack.js' | ||
], | ||
preprocessors: { | ||
'tests.webpack.js': ['webpack', 'sourcemap'] | ||
}, | ||
reporters: ['dots'], | ||
webpack: { | ||
devtool: 'inline-source-map', | ||
module: { | ||
loaders: [ | ||
{ test: /\.js$/, loaders: ['babel'], exclude: /node_modules/ } | ||
] | ||
}, | ||
resolve: { | ||
alias: { | ||
'react-dnd/modules': path.join(__dirname, './src'), | ||
'react-dnd': path.join(__dirname, './src') | ||
} | ||
} | ||
}, | ||
webpackServer: { | ||
noInfo: true | ||
} | ||
}); | ||
}; |
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,3 @@ | ||
#!/bin/sh | ||
|
||
./node_modules/.bin/karma start |
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,2 @@ | ||
var context = require.context('./examples', true, /-test\.js$/); | ||
context.keys().forEach(context); |