Bläddra i källkod

Merge pull request #641 from MarcoZehe/patch-1

Fix attribute value of aria-pressed so it reflects the actual state.
Danilo Bargen 6 år sedan
förälder
incheckning
0b5a473895
3 ändrade filer med 14 tillägg och 1 borttagningar
  1. 1 1
      src/components/toggle_button.ts
  2. 1 0
      src/threema/container.ts
  3. 12 0
      tests/ts/containers.ts

+ 1 - 1
src/components/toggle_button.ts

@@ -44,7 +44,7 @@ export default {
             role="button"
             tabindex="0"
             ng-click="$ctrl.action()"
-            aria-pressed="$ctrl.flag">
+            aria-pressed="{{ $ctrl.flag }}">
             <md-icon><img ng-src="{{ $ctrl.getIcon() }}"></md-icon>
         </md-button>
     `,

+ 1 - 0
src/threema/container.ts

@@ -286,6 +286,7 @@ export class Conversations implements threema.Container.Conversations {
             if (conversation.position !== undefined) {
                 delete conversation.position;
             }
+            setDefault(conversation, 'isStarred', false);
         }
         this.conversations = data;
     }

+ 12 - 0
tests/ts/containers.ts

@@ -36,6 +36,7 @@ function makeContactConversation(id: string, position?: number): threema.Convers
         messageCount: 5,
         unreadCount: 0,
         latestMessage: null,
+        isStarred: false,
     };
 }
 
@@ -84,6 +85,17 @@ describe('Container', () => {
                 delete expected.position;
                 expect((conversations as any).conversations).toEqual([expected]);
             });
+
+            it('sets defaults', function() {
+                const conversations = getConversations();
+
+                const conversation = makeContactConversation('1', 7);
+                delete conversation.isStarred;
+                conversations.set([conversation]);
+
+                const expected = makeContactConversation('1');
+                expect((conversations as any).conversations[0].isStarred).toEqual(false);
+            });
         });
 
         describe('add', function() {