Skip to content

Commit ee28a4a

Browse files
committed
Refactoring IntergerInputFormatter
1 parent 1211b4d commit ee28a4a

File tree

6 files changed

+11
-95
lines changed

6 files changed

+11
-95
lines changed

WooCommerce/Classes/Tools/UnitInputFormatter/IntegerInputFormatter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
/// `UnitInputFormatter` implementation for integer number input (positive, negative, or zero)
3+
/// `UnitInputFormatter` implementation for integer number input (positive, zero, negative)
44
///
55
struct IntegerInputFormatter: UnitInputFormatter {
66
private let numberFormatter: NumberFormatter = {

WooCommerce/Classes/Tools/UnitInputFormatter/PositiveIntegerInputFormatter.swift

Lines changed: 0 additions & 26 deletions
This file was deleted.

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: PositiveIntegerInputFormatter(),
24+
inputFormatter: IntegerInputFormatter(),
2525
onInputChange: onInputChange)
2626
}
2727
}

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 8 additions & 16 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 /* PositiveIntegerInputFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020B2F8E23BD9F1F00BD79AD /* PositiveIntegerInputFormatter.swift */; };
29-
020B2F9123BDD71500BD79AD /* PositiveIntegerInputFormatterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020B2F9023BDD71500BD79AD /* PositiveIntegerInputFormatterTests.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 */; };
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 */; };
@@ -270,8 +270,6 @@
270270
456CB50E2444BFAC00992A05 /* ProductPurchaseNoteViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 456CB50C2444BFAC00992A05 /* ProductPurchaseNoteViewController.xib */; };
271271
457151AB243B6E8000EB2DFA /* ProductSlugViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 457151A9243B6E8000EB2DFA /* ProductSlugViewController.swift */; };
272272
457151AC243B6E8000EB2DFA /* ProductSlugViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 457151AA243B6E8000EB2DFA /* ProductSlugViewController.xib */; };
273-
45745A32245306EC00570823 /* IntegerInputFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45745A31245306EC00570823 /* IntegerInputFormatter.swift */; };
274-
45745A3424530BD600570823 /* IntegerInputFormatterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45745A3324530BD600570823 /* IntegerInputFormatterTests.swift */; };
275273
4580BA7423F192D400B5F764 /* ProductSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4580BA7223F192D400B5F764 /* ProductSettingsViewController.swift */; };
276274
4580BA7523F192D400B5F764 /* ProductSettingsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4580BA7323F192D400B5F764 /* ProductSettingsViewController.xib */; };
277275
4580BA7723F19D4A00B5F764 /* ProductSettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4580BA7623F19D4A00B5F764 /* ProductSettingsViewModel.swift */; };
@@ -842,8 +840,8 @@
842840
0202B6912387AB0C00F3EBE0 /* WooTab+Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WooTab+Tag.swift"; sourceTree = "<group>"; };
843841
0202B6942387AD1B00F3EBE0 /* UITabBar+Order.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITabBar+Order.swift"; sourceTree = "<group>"; };
844842
0206483923FA4160008441BB /* OrdersRootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrdersRootViewController.swift; sourceTree = "<group>"; };
845-
020B2F8E23BD9F1F00BD79AD /* PositiveIntegerInputFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositiveIntegerInputFormatter.swift; sourceTree = "<group>"; };
846-
020B2F9023BDD71500BD79AD /* PositiveIntegerInputFormatterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositiveIntegerInputFormatterTests.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>"; };
847845
020B2F9323BDDBDC00BD79AD /* ProductUpdateError+UI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProductUpdateError+UI.swift"; sourceTree = "<group>"; };
848846
020B2F9823BDF2E000BD79AD /* DefaultProductFormTableViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultProductFormTableViewModelTests.swift; sourceTree = "<group>"; };
849847
020BE74723B05CF2007FE54C /* ProductInventoryEditableData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductInventoryEditableData.swift; sourceTree = "<group>"; };
@@ -1090,8 +1088,6 @@
10901088
456CB50C2444BFAC00992A05 /* ProductPurchaseNoteViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProductPurchaseNoteViewController.xib; sourceTree = "<group>"; };
10911089
457151A9243B6E8000EB2DFA /* ProductSlugViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductSlugViewController.swift; sourceTree = "<group>"; };
10921090
457151AA243B6E8000EB2DFA /* ProductSlugViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProductSlugViewController.xib; sourceTree = "<group>"; };
1093-
45745A31245306EC00570823 /* IntegerInputFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntegerInputFormatter.swift; sourceTree = "<group>"; };
1094-
45745A3324530BD600570823 /* IntegerInputFormatterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntegerInputFormatterTests.swift; sourceTree = "<group>"; };
10951091
4580BA7223F192D400B5F764 /* ProductSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductSettingsViewController.swift; sourceTree = "<group>"; };
10961092
4580BA7323F192D400B5F764 /* ProductSettingsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProductSettingsViewController.xib; sourceTree = "<group>"; };
10971093
4580BA7623F19D4A00B5F764 /* ProductSettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductSettingsViewModel.swift; sourceTree = "<group>"; };
@@ -2060,8 +2056,7 @@
20602056
02913E9623A774E600707A0C /* DecimalInputFormatter.swift */,
20612057
45B9C64223A91CB6007FC4C5 /* PriceInputFormatter.swift */,
20622058
021E2A1D23AA24C600B1DE07 /* StringInputFormatter.swift */,
2063-
020B2F8E23BD9F1F00BD79AD /* PositiveIntegerInputFormatter.swift */,
2064-
45745A31245306EC00570823 /* IntegerInputFormatter.swift */,
2059+
020B2F8E23BD9F1F00BD79AD /* IntegerInputFormatter.swift */,
20652060
45F5A3C023DF206B007D40E5 /* ShippingInputFormatter.swift */,
20662061
);
20672062
path = UnitInputFormatter;
@@ -2538,8 +2533,7 @@
25382533
D83F5936225B402E00626E75 /* EditableValueOneTableViewCellTests.swift */,
25392534
D82DFB4B225F303200EFE2CB /* EmptyListMessageWithActionTests.swift */,
25402535
D8F82AC422AF903700B67E4B /* IconsTests.swift */,
2541-
020B2F9023BDD71500BD79AD /* PositiveIntegerInputFormatterTests.swift */,
2542-
45745A3324530BD600570823 /* IntegerInputFormatterTests.swift */,
2536+
020B2F9023BDD71500BD79AD /* IntegerInputFormatterTests.swift */,
25432537
D8C11A6122E24C4A00D4A88D /* LedgerTableViewCellTests.swift */,
25442538
D83F593C225B4B5000626E75 /* ManualTrackingViewControllerTests.swift */,
25452539
D8AB131D225DC25F002BB5D1 /* MockOrders.swift */,
@@ -4526,7 +4520,7 @@
45264520
B57C5C9421B80E4700FF82B2 /* Data+Woo.swift in Sources */,
45274521
CE22E3FB21714776005A6BEF /* TopLeftImageTableViewCell.swift in Sources */,
45284522
B554E17B2152F27200F31188 /* UILabel+Appearance.swift in Sources */,
4529-
020B2F8F23BD9F1F00BD79AD /* PositiveIntegerInputFormatter.swift in Sources */,
4523+
020B2F8F23BD9F1F00BD79AD /* IntegerInputFormatter.swift in Sources */,
45304524
7441EBC9226A71AA008BF83D /* TitleBodyTableViewCell.swift in Sources */,
45314525
B541B21C2189F3D8008FE7C1 /* StringStyles.swift in Sources */,
45324526
B58B4AB82108F14700076FDD /* NoticeNotificationInfo.swift in Sources */,
@@ -4664,7 +4658,6 @@
46644658
F997174523DC068500592D8E /* XLPagerStrip+AccessibilityIdentifier.swift in Sources */,
46654659
D8C2A28B231931D100F503E9 /* ReviewViewModel.swift in Sources */,
46664660
B541B223218A29A6008FE7C1 /* NSParagraphStyle+Woo.swift in Sources */,
4667-
45745A32245306EC00570823 /* IntegerInputFormatter.swift in Sources */,
46684661
B50BB4162141828F00AF0F3C /* FooterSpinnerView.swift in Sources */,
46694662
02FE89C9231FB31400E85EF8 /* FeatureFlagService.swift in Sources */,
46704663
B5980A6321AC879F00EBF596 /* Bundle+Woo.swift in Sources */,
@@ -4847,7 +4840,7 @@
48474840
022A45EE237BADA6001417F0 /* Product+ProductFormTests.swift in Sources */,
48484841
B57C5C9921B80E7100FF82B2 /* DictionaryWooTests.swift in Sources */,
48494842
0290E27E238E5B5C00B5C466 /* ProductStockStatusListSelectorDataSourceTests.swift in Sources */,
4850-
020B2F9123BDD71500BD79AD /* PositiveIntegerInputFormatterTests.swift in Sources */,
4843+
020B2F9123BDD71500BD79AD /* IntegerInputFormatterTests.swift in Sources */,
48514844
D816DDBC22265DA300903E59 /* OrderTrackingTableViewCellTests.swift in Sources */,
48524845
D85136DD231E613900DD0539 /* ReviewsViewModelTests.swift in Sources */,
48534846
D85B833D2230DC9D002168F3 /* StringWooTests.swift in Sources */,
@@ -4856,7 +4849,6 @@
48564849
02E4FD812306AA890049610C /* StatsTimeRangeBarViewModelTests.swift in Sources */,
48574850
45FBDF34238D33F100127F77 /* MockProduct.swift in Sources */,
48584851
6856D2A5C2076F5BF14F2C11 /* KeyboardStateProviderTests.swift in Sources */,
4859-
45745A3424530BD600570823 /* IntegerInputFormatterTests.swift in Sources */,
48604852
6856D806DE7DB61522D54044 /* NSMutableAttributedStringHelperTests.swift in Sources */,
48614853
6856DF20E1BDCC391635F707 /* AgeTests.swift in Sources */,
48624854
6856DE479EC3B2265AC1F775 /* Calendar+Extensions.swift in Sources */,

WooCommerce/WooCommerceTests/Tools/IntegerInputFormatterTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import XCTest
2+
23
@testable import WooCommerce
34

45
final class IntegerInputFormatterTests: XCTestCase {

WooCommerce/WooCommerceTests/Tools/PositiveIntegerInputFormatterTests.swift

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)