From 19cfe64455d805e7c21a4176256cc3e72d062d0b Mon Sep 17 00:00:00 2001
From: Kai Schaper <303@posteo.de>
Date: Thu, 20 Oct 2016 17:34:44 +0200
Subject: add/update specs for Button, DisplayName, DropdownMenu

---
 spec/javascript/components/display_name.test.jsx | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

(limited to 'spec/javascript/components/display_name.test.jsx')

diff --git a/spec/javascript/components/display_name.test.jsx b/spec/javascript/components/display_name.test.jsx
index c25eb8530..e5a932f4b 100644
--- a/spec/javascript/components/display_name.test.jsx
+++ b/spec/javascript/components/display_name.test.jsx
@@ -5,15 +5,23 @@ import Immutable  from 'immutable';
 import DisplayName from '../../../app/assets/javascripts/components/components/display_name'
 
 describe('<DisplayName />', () => {
-  const account = Immutable.fromJS({
-    username: 'bar',
-    acct: 'bar@baz',
-    display_name: 'Foo'
+  it('renders display name + account name', () => {
+    const account = Immutable.fromJS({
+      username: 'bar',
+      acct: 'bar@baz',
+      display_name: 'Foo'
+    });
+    const wrapper = render(<DisplayName account={account} />);
+    expect(wrapper).to.have.text('Foo @bar@baz');
   });
 
-  const wrapper = render(<DisplayName account={account} />);
-
-  it('renders display name', () => {
-    expect(wrapper.text()).to.match(/Foo @bar@baz/);
+  it('renders the username + account name if display name is empty', () => {
+    const account = Immutable.fromJS({
+      username: 'bar',
+      acct: 'bar@baz',
+      display_name: ''
+    });
+    const wrapper = render(<DisplayName account={account} />);
+    expect(wrapper).to.have.text('bar @bar@baz');
   });
 });
-- 
cgit 

