Add a test for ActionsDropDown component
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 06 Apr 2017 09:36:54 +0200
changeset 84 f3320a200bf7
parent 83 2aac210e9a15
child 85 3af45ba4cb13
Add a test for ActionsDropDown component
test/index.js
--- a/test/index.js	Thu Apr 06 09:57:48 2017 +0200
+++ b/test/index.js	Thu Apr 06 09:36:54 2017 +0200
@@ -10,7 +10,7 @@
 import {buildFormData} from '../src/utils';
 import {Api} from '../src/Api';
 import defaultApi from '../src/Api';
-import {ActionLink, OneLineView} from '../src/components/BaseViews';
+import {ActionLink, ActionsDropDown, OneLineView} from '../src/components/BaseViews';
 import {EntityMeta} from '../src/components/Entity';
 import {wrapEntityData} from "../src/jsonaryutils";
 
@@ -187,6 +187,19 @@
     });
 });
 
+describe('<ActionsDropDown />', () => {
+    const targetResource = {
+        allowedActions: ["view", "create", "edit", "delete"],
+        url: "/here/",
+        data: {},
+    }
+
+    it('renders a dropdown button with actions from target', () => {
+        const wrapper = shallow(<ActionsDropDown target={targetResource}/>);
+        expect(wrapper.find('ActionLink')).to.have.length(4);
+    });
+
+});
 describe('<ActionLink />', () => {
     let targetResource;
     beforeEach(() => {