Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm

Issue 2589583003: Upstream Chrome on iOS source code [7/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm
diff --git a/ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..1038a301bcda3da170ff2f64a53ead7d74ac6a25
--- /dev/null
+++ b/ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/ui/settings/cells/autofill_data_item.h"
+
+#import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/gtest_mac.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+// Tests that the UILabels are set properly after a call to |configureCell:|.
+TEST(AutofillDataItemTest, TextLabels) {
+ AutofillDataItem* item = [[AutofillDataItem alloc] initWithType:0];
+ NSString* mainText = @"Main text";
+ NSString* leadingDetailText = @"Leading detail text";
+ NSString* trailingDetailText = @"Trailing detail text";
+
+ item.text = mainText;
+ item.leadingDetailText = leadingDetailText;
+ item.trailingDetailText = trailingDetailText;
+ item.accessoryType = MDCCollectionViewCellAccessoryCheckmark;
+
+ id cell = [[[item cellClass] alloc] init];
+ ASSERT_TRUE([cell isMemberOfClass:[AutofillDataCell class]]);
+
+ AutofillDataCell* autofillDataCell = cell;
+ EXPECT_FALSE(autofillDataCell.textLabel.text);
+ EXPECT_FALSE(autofillDataCell.leadingDetailTextLabel.text);
+ EXPECT_FALSE(autofillDataCell.trailingDetailTextLabel.text);
+ EXPECT_EQ(MDCCollectionViewCellAccessoryNone, autofillDataCell.accessoryType);
+
+ [item configureCell:cell];
+ EXPECT_NSEQ(mainText, autofillDataCell.textLabel.text);
+ EXPECT_NSEQ(leadingDetailText, autofillDataCell.leadingDetailTextLabel.text);
+ EXPECT_NSEQ(trailingDetailText,
+ autofillDataCell.trailingDetailTextLabel.text);
+ EXPECT_EQ(MDCCollectionViewCellAccessoryCheckmark,
+ autofillDataCell.accessoryType);
+}
« no previous file with comments | « ios/chrome/browser/ui/settings/cells/autofill_data_item.mm ('k') | ios/chrome/browser/ui/settings/cells/autofill_edit_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698