Github user michellephung commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/543#discussion_r42291979
--- Diff:
app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
---
@@ -13,79 +13,196 @@ define([
'api',
'addons/documents/index-results/index-results.components.react',
'addons/documents/index-results/actions',
+ 'addons/documents/index-results/stores',
'addons/documents/resources',
'addons/databases/resources',
'testUtils',
"react"
-], function (FauxtonAPI, Views, IndexResultsActions, Resources, Databases,
utils, React) {
+], function (FauxtonAPI, Views, IndexResultsActions, Stores, Documents,
Databases, utils, React) {
FauxtonAPI.router = new FauxtonAPI.Router([]);
var assert = utils.assert;
var TestUtils = React.addons.TestUtils;
+ var store = Stores.indexResultsStore;
describe('Index Results', function () {
- var container, el;
+ var container, instance;
- beforeEach(function () {
- container = document.createElement('div');
- });
+ describe('no results text', function () {
+ beforeEach(function () {
+ container = document.createElement('div');
+ store.reset();
+ });
- afterEach(function () {
- React.unmountComponentAtNode(container);
- });
+ afterEach(function () {
+
React.unmountComponentAtNode(React.findDOMNode(instance).parentNode);
+ store.reset();
+ });
+
+ it('renders a default text', function () {
+ IndexResultsActions.newResultsList({
+ collection: [],
+ deleteable: true
+ });
+ IndexResultsActions.resultsListReset();
- it('renders a default text', function () {
- IndexResultsActions.newResultsList({
- collection: [],
- deleteable: true
+ instance = TestUtils.renderIntoDocument(<Views.List />, container);
+ var $el = $(instance.getDOMNode());
+ assert.equal($el.text(), 'No Index Created Yet!');
});
- IndexResultsActions.resultsListReset();
- el = TestUtils.renderIntoDocument(<Views.List />, container);
- var $el = $(el.getDOMNode());
- assert.equal($el.text(), 'No Index Created Yet!');
+ it('you can change the default text', function () {
+ IndexResultsActions.newResultsList({
+ collection: [],
+ deleteable: true,
+ textEmptyIndex: 'I <3 Hamburg'
+ });
+
+ instance = TestUtils.renderIntoDocument(<Views.List />, container);
+ var $el = $(instance.getDOMNode());
+ assert.equal($el.text(), 'I <3 Hamburg');
--- End diff --
:heart:
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---