Skip to content

Commit 1311721

Browse files
committed
Renamed IntegerInputFormatter to PositiveIntegerInputFormatter since it accept only positive integers
1 parent c2e5c51 commit 1311721

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

WooCommerce/Classes/Tools/UnitInputFormatter/IntegerInputFormatter.swift renamed to WooCommerce/Classes/Tools/UnitInputFormatter/PositiveIntegerInputFormatter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import Foundation
22

3-
/// `UnitInputFormatter` implementation for integer number input.
3+
/// `UnitInputFormatter` implementation for positive integer number input.
44
///
5-
struct IntegerInputFormatter: UnitInputFormatter {
5+
struct PositiveIntegerInputFormatter: UnitInputFormatter {
66
func isValid(input: String) -> Bool {
77
guard input.isEmpty == false else {
88
// Allows empty input to be replaced by 0.

WooCommerce/Classes/ViewRelated/Products/Edit Product/Inventory Settings/Product+InventorySettingsViewModels.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extension Product {
2121
placeholder: "0",
2222
unitPosition: .none,
2323
keyboardType: .numberPad,
24-
inputFormatter: IntegerInputFormatter(),
24+
inputFormatter: PositiveIntegerInputFormatter(),
2525
onInputChange: onInputChange)
2626
}
2727
}

WooCommerce/Classes/ViewRelated/Products/Edit Product/Product Settings/Menu Order/ProductMenuOrderViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private extension ProductMenuOrderViewController {
139139
}
140140
}, onTextDidBeginEditing: {
141141
//TODO: Add analytics track
142-
}, inputFormatter: IntegerInputFormatter())
142+
}, inputFormatter: PositiveIntegerInputFormatter())
143143
cell.configure(viewModel: viewModel)
144144
cell.textField.applyBodyStyle()
145145
cell.textField.keyboardType = .decimalPad

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
0202B6922387AB0C00F3EBE0 /* WooTab+Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0202B6912387AB0C00F3EBE0 /* WooTab+Tag.swift */; };
2626
0202B6952387AD1B00F3EBE0 /* UITabBar+Order.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0202B6942387AD1B00F3EBE0 /* UITabBar+Order.swift */; };
2727
0206483A23FA4160008441BB /* OrdersRootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0206483923FA4160008441BB /* OrdersRootViewController.swift */; };
28-
020B2F8F23BD9F1F00BD79AD /* IntegerInputFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020B2F8E23BD9F1F00BD79AD /* IntegerInputFormatter.swift */; };
29-
020B2F9123BDD71500BD79AD /* IntegerInputFormatterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020B2F9023BDD71500BD79AD /* IntegerInputFormatterTests.swift */; };
28+
020B2F8F23BD9F1F00BD79AD /* PositiveIntegerInputFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020B2F8E23BD9F1F00BD79AD /* PositiveIntegerInputFormatter.swift */; };
29+
020B2F9123BDD71500BD79AD /* PositiveIntegerInputFormatterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020B2F9023BDD71500BD79AD /* PositiveIntegerInputFormatterTests.swift */; };
3030
020B2F9423BDDBDC00BD79AD /* ProductUpdateError+UI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020B2F9323BDDBDC00BD79AD /* ProductUpdateError+UI.swift */; };
3131
020B2F9923BDF2E000BD79AD /* DefaultProductFormTableViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020B2F9823BDF2E000BD79AD /* DefaultProductFormTableViewModelTests.swift */; };
3232
020BE74823B05CF2007FE54C /* ProductInventoryEditableData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020BE74723B05CF2007FE54C /* ProductInventoryEditableData.swift */; };
@@ -840,8 +840,8 @@
840840
0202B6912387AB0C00F3EBE0 /* WooTab+Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WooTab+Tag.swift"; sourceTree = "<group>"; };
841841
0202B6942387AD1B00F3EBE0 /* UITabBar+Order.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITabBar+Order.swift"; sourceTree = "<group>"; };
842842
0206483923FA4160008441BB /* OrdersRootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrdersRootViewController.swift; sourceTree = "<group>"; };
843-
020B2F8E23BD9F1F00BD79AD /* IntegerInputFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntegerInputFormatter.swift; sourceTree = "<group>"; };
844-
020B2F9023BDD71500BD79AD /* IntegerInputFormatterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntegerInputFormatterTests.swift; sourceTree = "<group>"; };
843+
020B2F8E23BD9F1F00BD79AD /* PositiveIntegerInputFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositiveIntegerInputFormatter.swift; sourceTree = "<group>"; };
844+
020B2F9023BDD71500BD79AD /* PositiveIntegerInputFormatterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositiveIntegerInputFormatterTests.swift; sourceTree = "<group>"; };
845845
020B2F9323BDDBDC00BD79AD /* ProductUpdateError+UI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProductUpdateError+UI.swift"; sourceTree = "<group>"; };
846846
020B2F9823BDF2E000BD79AD /* DefaultProductFormTableViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultProductFormTableViewModelTests.swift; sourceTree = "<group>"; };
847847
020BE74723B05CF2007FE54C /* ProductInventoryEditableData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductInventoryEditableData.swift; sourceTree = "<group>"; };
@@ -2056,7 +2056,7 @@
20562056
02913E9623A774E600707A0C /* DecimalInputFormatter.swift */,
20572057
45B9C64223A91CB6007FC4C5 /* PriceInputFormatter.swift */,
20582058
021E2A1D23AA24C600B1DE07 /* StringInputFormatter.swift */,
2059-
020B2F8E23BD9F1F00BD79AD /* IntegerInputFormatter.swift */,
2059+
020B2F8E23BD9F1F00BD79AD /* PositiveIntegerInputFormatter.swift */,
20602060
45F5A3C023DF206B007D40E5 /* ShippingInputFormatter.swift */,
20612061
);
20622062
path = UnitInputFormatter;
@@ -2533,7 +2533,7 @@
25332533
D83F5936225B402E00626E75 /* EditableValueOneTableViewCellTests.swift */,
25342534
D82DFB4B225F303200EFE2CB /* EmptyListMessageWithActionTests.swift */,
25352535
D8F82AC422AF903700B67E4B /* IconsTests.swift */,
2536-
020B2F9023BDD71500BD79AD /* IntegerInputFormatterTests.swift */,
2536+
020B2F9023BDD71500BD79AD /* PositiveIntegerInputFormatterTests.swift */,
25372537
D8C11A6122E24C4A00D4A88D /* LedgerTableViewCellTests.swift */,
25382538
D83F593C225B4B5000626E75 /* ManualTrackingViewControllerTests.swift */,
25392539
D8AB131D225DC25F002BB5D1 /* MockOrders.swift */,
@@ -4520,7 +4520,7 @@
45204520
B57C5C9421B80E4700FF82B2 /* Data+Woo.swift in Sources */,
45214521
CE22E3FB21714776005A6BEF /* TopLeftImageTableViewCell.swift in Sources */,
45224522
B554E17B2152F27200F31188 /* UILabel+Appearance.swift in Sources */,
4523-
020B2F8F23BD9F1F00BD79AD /* IntegerInputFormatter.swift in Sources */,
4523+
020B2F8F23BD9F1F00BD79AD /* PositiveIntegerInputFormatter.swift in Sources */,
45244524
7441EBC9226A71AA008BF83D /* TitleBodyTableViewCell.swift in Sources */,
45254525
B541B21C2189F3D8008FE7C1 /* StringStyles.swift in Sources */,
45264526
B58B4AB82108F14700076FDD /* NoticeNotificationInfo.swift in Sources */,
@@ -4840,7 +4840,7 @@
48404840
022A45EE237BADA6001417F0 /* Product+ProductFormTests.swift in Sources */,
48414841
B57C5C9921B80E7100FF82B2 /* DictionaryWooTests.swift in Sources */,
48424842
0290E27E238E5B5C00B5C466 /* ProductStockStatusListSelectorDataSourceTests.swift in Sources */,
4843-
020B2F9123BDD71500BD79AD /* IntegerInputFormatterTests.swift in Sources */,
4843+
020B2F9123BDD71500BD79AD /* PositiveIntegerInputFormatterTests.swift in Sources */,
48444844
D816DDBC22265DA300903E59 /* OrderTrackingTableViewCellTests.swift in Sources */,
48454845
D85136DD231E613900DD0539 /* ReviewsViewModelTests.swift in Sources */,
48464846
D85B833D2230DC9D002168F3 /* StringWooTests.swift in Sources */,

WooCommerce/WooCommerceTests/Tools/IntegerInputFormatterTests.swift renamed to WooCommerce/WooCommerceTests/Tools/PositiveIntegerInputFormatterTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import XCTest
22

33
@testable import WooCommerce
44

5-
final class IntegerInputFormatterTests: XCTestCase {
6-
private let formatter = IntegerInputFormatter()
5+
final class PositiveIntegerInputFormatterTests: XCTestCase {
6+
private let formatter = PositiveIntegerInputFormatter()
77

88
// MARK: test cases for `isValid(input:)`
99

0 commit comments

Comments
 (0)