-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
CollectionViewBoundMultiSelection.cs
63 lines (52 loc) · 1.79 KB
/
CollectionViewBoundMultiSelection.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.Forms.Core.UITests;
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.CollectionView)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.None, 47803, "CollectionView: Multi Selection Binding", PlatformAffected.All)]
public class CollectionViewBoundMultiSelection : TestNavigationPage
{
protected override void Init()
{
#if APP
Device.SetFlags(new List<string>(Device.Flags ?? new List<string>()) { "CollectionView_Experimental" });
PushAsync(new GalleryPages.CollectionViewGalleries.SelectionGalleries.MultipleBoundSelection());
#endif
}
#if UITEST
[Test]
public void ItemsFromViewModelShouldBeSelected()
{
// Initially Items 1 and 2 should be selected (from the view model)
RunningApp.WaitForElement("Selected: Item 1, Item 2");
// Tapping Item 3 should select it and updating the binding
RunningApp.Tap("Item 3");
RunningApp.WaitForElement("Selected: Item 1, Item 2, Item 3");
// Test clearing the selection from the view model and updating it
RunningApp.Tap("ClearAndAdd");
RunningApp.WaitForElement("Selected: Item 1, Item 2");
// Test removing an item from the selection
RunningApp.Tap("Item 2");
RunningApp.WaitForElement("Selected: Item 1");
// Test setting a new selection list in the view mdoel
RunningApp.Tap("Reset");
RunningApp.WaitForElement("Selected: Item 1, Item 2");
RunningApp.Tap("Item 0");
// Test setting the selection directly with CollectionView.SelectedItems
RunningApp.Tap("DirectUpdate");
RunningApp.WaitForElement("Selected: Item 0, Item 3");
}
#endif
}
}