Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/544#discussion_r41140262
--- Diff: app/addons/fauxton/tests/componentsSpec.react.jsx ---
@@ -204,5 +207,169 @@ define([
});
-});
+ describe('Clipboard', function () {
+ var container;
+ beforeEach(function () {
+ container = document.createElement('div');
+ });
+
+ afterEach(function () {
+ React.unmountComponentAtNode(container);
+ });
+
+ it('shows a clipboard icon by default', function () {
+ var clipboard = React.render(<Views.Clipboard text="copy me" />,
container);
+
assert.equal($(clipboard.getDOMNode()).find('.fonticon-clipboard').length, 1);
+ });
+
+ it('shows text if specified', function () {
+ var clipboard = React.render(<Views.Clipboard displayType="text"
text="copy me" />, container);
+
assert.equal($(clipboard.getDOMNode()).find('.fonticon-clipboard').length, 0);
+ });
+
+ it('shows custom text if specified ', function () {
+ var clipboard = React.render(<Views.Clipboard displayType="text"
textDisplay='booyah!' text="copy me" />, container);
+ assert.ok(/booyah!/.test($(clipboard.getDOMNode())[0].outerHTML));
+ });
+
+ });
+
+
+ describe('NotificationRow', function () {
+ var container;
+
+ var notifications = {
+ success: {
+ notificationId: 1,
+ type: 'success',
+ msg: 'Success!',
+ time: moment()
+ },
+ info: {
+ notificationId: 2,
+ type: 'info',
+ msg: 'Error!',
+ time: moment()
+ },
+ error: {
+ notificationId: 3,
+ type: 'error',
+ msg: 'Error!',
+ time: moment()
+ }
+ };
+
+ beforeEach(function () {
+ container = document.createElement('div');
+ });
+
+ afterEach(function () {
+ React.unmountComponentAtNode(container);
+ });
+
+ it('shows all notification types when "all" filter applied', function
() {
+ var row1 = React.render(
+ <Views.NotificationRow filter="all" item={notifications.success}
transitionSpeed={0} />,
+ container
+ );
+ assert.equal($(row1.getDOMNode()).data('visible'), true);
+ React.unmountComponentAtNode(container);
+
+ var row2 = React.render(
+ <Views.NotificationRow filter="all" item={notifications.error}
transitionSpeed={0} />,
+ container
+ );
+ assert.equal($(row2.getDOMNode()).data('visible'), true);
+ React.unmountComponentAtNode(container);
+
+ var row3 = React.render(
+ <Views.NotificationRow filter="all" item={notifications.info}
transitionSpeed={0} />,
+ container
+ );
+ assert.equal($(row3.getDOMNode()).data('visible'), true);
+ React.unmountComponentAtNode(container);
+ });
+
+ it('hides notification when filter doesn\'t match', function () {
+ var rowEl = React.render(
+ <Views.NotificationRow filter="success" item={notifications.info}
transitionSpeed={0} />,
+ container
+ );
+ assert.equal($(rowEl.getDOMNode()).data('visible'), false);
+ });
+
+ it('shows notification when filter exact match', function () {
+ var rowEl = React.render(
+ <Views.NotificationRow filter="info" item={notifications.info}
transitionSpeed={0} />,
+ container
+ );
+ assert.equal($(rowEl.getDOMNode()).data('visible'), true);
+ });
+
+ });
+
+
+ describe('NotificationCenterPanel', function () {
+ var container;
+
+ beforeEach(function () {
+ container = document.createElement('div');
+ store.reset();
+ });
+
+ afterEach(function () {
+ React.unmountComponentAtNode(container);
+ });
+
+ it('shows all notifications by default', function () {
+ store.addNotification({ type: 'success', msg: 'Success are okay' });
+ store.addNotification({ type: 'success', msg: 'another success.' });
+ store.addNotification({ type: 'info', msg: 'A single info message'
});
+ store.addNotification({ type: 'error', msg: 'Error #1' });
+ store.addNotification({ type: 'error', msg: 'Error #2' });
+ store.addNotification({ type: 'error', msg: 'Error #3' });
+
+ var panelEl = React.render(<Views.NotificationCenterPanel />,
container);
+ assert.equal($(panelEl.getDOMNode()).find('.notification-list
li[data-visible=true]').length, 6);
--- End diff --
what is that `data-visible` thing?
---
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.
---