]> source.dussan.org Git - sonarqube.git/commitdiff
Update members display
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Tue, 18 Apr 2017 07:28:43 +0000 (09:28 +0200)
committerGrégoire Aubert <gregaubert@users.noreply.github.com>
Mon, 1 May 2017 14:26:31 +0000 (16:26 +0200)
it/it-tests/src/test/java/pageobjects/organization/MemberItem.java
server/sonar-web/src/main/js/apps/organizations/components/MembersListItem.js
server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/MembersListItem-test.js.snap
server/sonar-web/src/main/js/apps/users/components/UsersSelectSearchOption.js
server/sonar-web/src/main/js/apps/users/components/__tests__/__snapshots__/UsersSelectSearchOption-test.js.snap
server/sonar-web/src/main/js/store/organizationsMembers/reducer.js

index f3099f5ec7fc319e00214f516a3ec777d2ba3d81..436637d489f548ad931ad8c594093199f87058d4 100644 (file)
@@ -36,8 +36,8 @@ public class MemberItem {
 
   public MemberItem shouldBeNamed(String login, String name) {
     ElementsCollection tds = this.elt.$$("td");
-    tds.get(1).$("strong").shouldHave(Condition.text(login));
-    tds.get(1).$("span").shouldHave(Condition.text(name));
+    tds.get(1).$("strong").shouldHave(Condition.text(name));
+    tds.get(1).$("span").shouldHave(Condition.text(login));
     return this;
   }
 
index 751b92275accc54e515273ad3935e41faefc3711..df9a14965034aef3cd2ddb46f140cef4eb7886db 100644 (file)
@@ -48,8 +48,8 @@ export default class MembersListItem extends React.PureComponent {
           <Avatar hash={member.avatar} email={member.email} size={AVATAR_SIZE} />
         </td>
         <td className="nowrap text-middle">
-          <strong>{member.login}</strong>
-          <span className="note little-spacer-left">{member.name}</span>
+          <strong>{member.name}</strong>
+          <span className="note little-spacer-left">{member.login}</span>
         </td>
         {organization.canAdmin &&
           <td className="text-right text-middle">
index 8a3ac0d24accad46a1108489c7606273969eaaa6..153c98f4d352063c9400289ace6821d4e98c3fac 100644 (file)
@@ -1,53 +1,40 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should groups at 0 if the groupCount field is not defined (just added user) 1`] = `
+exports[`test should groups at 0 if the groupCount field is not defined (just added user) 1`] = `
 <tr>
   <td
-    className="thin nowrap"
-  >
+    className="thin nowrap">
     <Connect(Avatar)
       hash="7daf6c79d4802916d83f6266e24850af"
-      size={36}
-    />
+      size={36} />
   </td>
   <td
-    className="nowrap text-middle"
-  >
+    className="nowrap text-middle">
     <strong>
-      john
+      John Doe
     </strong>
     <span
-      className="note little-spacer-left"
-    >
-      John Doe
+      className="note little-spacer-left">
+      john
     </span>
   </td>
   <td
-    className="text-right text-middle"
-  >
+    className="text-right text-middle">
     organization.members.x_groups.0
   </td>
   <td
-    className="nowrap text-middle text-right"
-  >
+    className="nowrap text-middle text-right">
     <div
-      className="dropdown"
-    >
+      className="dropdown">
       <button
         className="dropdown-toggle little-spacer-right"
-        data-toggle="dropdown"
-      >
+        data-toggle="dropdown">
         <i
-          className="icon-settings"
-        />
+          className="icon-settings" />
          
         <i
-          className="icon-dropdown"
-        />
+          className="icon-dropdown" />
       </button>
       <ul
-        className="dropdown-menu dropdown-menu-right"
-      >
+        className="dropdown-menu dropdown-menu-right">
         <li>
           <ManageMemberGroupsForm
             member={
@@ -63,13 +50,11 @@ exports[`should groups at 0 if the groupCount field is not defined (just added u
                 "key": "foo",
                 "name": "Foo",
               }
-            }
-          />
+            } />
         </li>
         <li
           className="divider"
-          role="separator"
-        />
+          role="separator" />
         <li>
           <RemoveMemberForm
             member={
@@ -85,8 +70,7 @@ exports[`should groups at 0 if the groupCount field is not defined (just added u
                 "key": "foo",
                 "name": "Foo",
               }
-            }
-          />
+            } />
         </li>
       </ul>
     </div>
@@ -94,79 +78,64 @@ exports[`should groups at 0 if the groupCount field is not defined (just added u
 </tr>
 `;
 
-exports[`should not render actions and groups for non admin 1`] = `
+exports[`test should not render actions and groups for non admin 1`] = `
 <tr>
   <td
-    className="thin nowrap"
-  >
+    className="thin nowrap">
     <Connect(Avatar)
       hash=""
-      size={36}
-    />
+      size={36} />
   </td>
   <td
-    className="nowrap text-middle"
-  >
+    className="nowrap text-middle">
     <strong>
-      admin
+      Admin Istrator
     </strong>
     <span
-      className="note little-spacer-left"
-    >
-      Admin Istrator
+      className="note little-spacer-left">
+      admin
     </span>
   </td>
 </tr>
 `;
 
-exports[`should render actions and groups for admin 1`] = `
+exports[`test should render actions and groups for admin 1`] = `
 <tr>
   <td
-    className="thin nowrap"
-  >
+    className="thin nowrap">
     <Connect(Avatar)
       hash=""
-      size={36}
-    />
+      size={36} />
   </td>
   <td
-    className="nowrap text-middle"
-  >
+    className="nowrap text-middle">
     <strong>
-      admin
+      Admin Istrator
     </strong>
     <span
-      className="note little-spacer-left"
-    >
-      Admin Istrator
+      className="note little-spacer-left">
+      admin
     </span>
   </td>
   <td
-    className="text-right text-middle"
-  >
+    className="text-right text-middle">
     organization.members.x_groups.3
   </td>
   <td
-    className="nowrap text-middle text-right"
-  >
+    className="nowrap text-middle text-right">
     <div
-      className="dropdown"
-    >
+      className="dropdown">
       <button
         className="dropdown-toggle little-spacer-right"
-        data-toggle="dropdown"
-      >
+        data-toggle="dropdown">
         <i
-          className="icon-settings"
-        />
+          className="icon-settings" />
          
         <i
-          className="icon-dropdown"
-        />
+          className="icon-dropdown" />
       </button>
       <ul
-        className="dropdown-menu dropdown-menu-right"
-      >
+        className="dropdown-menu dropdown-menu-right">
         <li>
           <ManageMemberGroupsForm
             member={
@@ -183,13 +152,11 @@ exports[`should render actions and groups for admin 1`] = `
                 "key": "foo",
                 "name": "Foo",
               }
-            }
-          />
+            } />
         </li>
         <li
           className="divider"
-          role="separator"
-        />
+          role="separator" />
         <li>
           <RemoveMemberForm
             member={
@@ -206,8 +173,7 @@ exports[`should render actions and groups for admin 1`] = `
                 "key": "foo",
                 "name": "Foo",
               }
-            }
-          />
+            } />
         </li>
       </ul>
     </div>
index 8cf4c65f3706f442f58baccb6a660c52b33c93c7..125a20a5f0e85938c931b9101b0115fde0bcfda6 100644 (file)
@@ -64,8 +64,8 @@ export default class UsersSelectSearchOption extends React.PureComponent {
         title={user.name}>
         <div className="little-spacer-bottom little-spacer-top">
           <Avatar hash={user.avatar} email={user.email} size={AVATAR_SIZE} />
-          <strong className="spacer-left">{user.login}</strong>
-          <span className="note little-spacer-left">{this.props.children}</span>
+          <strong className="spacer-left">{this.props.children}</strong>
+          <span className="note little-spacer-left">{user.login}</span>
         </div>
       </div>
     );
index 94b1e8414c918c110c550e212fc91fd05168ace9..9ee1a0b7206c1e3af852981b6b5f0432916fe71e 100644 (file)
@@ -1,56 +1,44 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly with email instead of hash 1`] = `
+exports[`test should render correctly with email instead of hash 1`] = `
 <div
   onMouseDown={[Function]}
   onMouseEnter={[Function]}
   onMouseMove={[Function]}
-  title="Administrator"
->
+  title="Administrator">
   <div
-    className="little-spacer-bottom little-spacer-top"
-  >
+    className="little-spacer-bottom little-spacer-top">
     <Connect(Avatar)
       email="admin@admin.ch"
-      size={20}
-    />
+      size={20} />
     <strong
-      className="spacer-left"
-    >
-      admin
+      className="spacer-left">
+      Administrator
     </strong>
     <span
-      className="note little-spacer-left"
-    >
-      Administrator
+      className="note little-spacer-left">
+      admin
     </span>
   </div>
 </div>
 `;
 
-exports[`should render correctly without all parameters 1`] = `
+exports[`test should render correctly without all parameters 1`] = `
 <div
   onMouseDown={[Function]}
   onMouseEnter={[Function]}
   onMouseMove={[Function]}
-  title="Administrator"
->
+  title="Administrator">
   <div
-    className="little-spacer-bottom little-spacer-top"
-  >
+    className="little-spacer-bottom little-spacer-top">
     <Connect(Avatar)
       hash="7daf6c79d4802916d83f6266e24850af"
-      size={20}
-    />
+      size={20} />
     <strong
-      className="spacer-left"
-    >
-      admin
+      className="spacer-left">
+      Administrator
     </strong>
     <span
-      className="note little-spacer-left"
-    >
-      Administrator
+      className="note little-spacer-left">
+      admin
     </span>
   </div>
 </div>
index d1ceb15087da4d6add4520eae0ef799c541cd80d..3a2e141070367bb77bb4b147d7f2182a4c156e6e 100644 (file)
@@ -51,7 +51,7 @@ const organizationMembers = (state = {}, action = {}) => {
       const withNew = [...members, action.member.login].sort();
       return {
         ...state,
-        total: withNew.length,
+        total: state.total + 1,
         members: withNew
       };
     }
@@ -62,7 +62,7 @@ const organizationMembers = (state = {}, action = {}) => {
       }
       return {
         ...state,
-        total: withoutDeleted.length,
+        total: state.total - 1,
         members: withoutDeleted
       };
     }