Skip to content

Commit

Permalink
Cleanup based on Zev's PR review.
Browse files Browse the repository at this point in the history
  • Loading branch information
Imperiopolis committed May 17, 2016
1 parent 993f2a1 commit b8ea5ba
Show file tree
Hide file tree
Showing 23 changed files with 275 additions and 189 deletions.
28 changes: 16 additions & 12 deletions Example/BonMot.xcodeproj/project.pbxproj
Expand Up @@ -64,12 +64,13 @@
CD6DF05A1BF6B98500676E2D /* NSDictionary+BONEquality.m in Sources */ = {isa = PBXBuildFile; fileRef = CD6DF04F1BF6B53100676E2D /* NSDictionary+BONEquality.m */; };
CD78701E1CA5F8EC00B2714F /* EBGaramond12-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = CD6DF03E1BF6AFAA00676E2D /* EBGaramond12-Regular.otf */; };
CDE658581C24ADD8009C7D09 /* BONUnderlineAndStrikethroughTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = CDE658571C24ADD8009C7D09 /* BONUnderlineAndStrikethroughTestCase.m */; };
EC2F199E1CEA324900D9F1FE /* BONTagDictionaryStylesTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = EC2F199C1CEA324300D9F1FE /* BONTagDictionaryStylesTestCase.m */; };
EC433DB31C88B7D9001B3ABE /* BONTagStylesTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = EC433DB11C88B65B001B3ABE /* BONTagStylesTestCase.m */; };
EC2F199E1CEA324900D9F1FE /* BONTagStylesTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = EC2F199C1CEA324300D9F1FE /* BONTagStylesTestCase.m */; };
EC2F19A11CEBBAF900D9F1FE /* BONTagTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = EC2F199F1CEBBA9E00D9F1FE /* BONTagTestCase.m */; };
EC433DB31C88B7D9001B3ABE /* BONTagMakeTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = EC433DB11C88B65B001B3ABE /* BONTagMakeTestCase.m */; };
EC433DB61C88BBDE001B3ABE /* BONUIKitUtilitiesTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = EC433DB41C88BBDB001B3ABE /* BONUIKitUtilitiesTestCase.m */; };
EC433DB91C88DE5F001B3ABE /* TagStylesCell.m in Sources */ = {isa = PBXBuildFile; fileRef = EC433DB81C88DE5F001B3ABE /* TagStylesCell.m */; };
EC433DBB1C88DEF7001B3ABE /* TagStylesCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = EC433DBA1C88DEF7001B3ABE /* TagStylesCell.xib */; };
ECD4DB6B1CE3EA2700079675 /* BONTagComplexStylesTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD4DB691CE3EA1F00079675 /* BONTagComplexStylesTestCase.m */; };
ECD4DB6B1CE3EA2700079675 /* BONTagComplexMakeTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD4DB691CE3EA1F00079675 /* BONTagComplexMakeTestCase.m */; };
F6E9CEC93164745FB8BEB8FC /* Pods_BonMot_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2E8BB0552A748FFBA2BD0BE4 /* Pods_BonMot_Example.framework */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -169,13 +170,14 @@
CDE658571C24ADD8009C7D09 /* BONUnderlineAndStrikethroughTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONUnderlineAndStrikethroughTestCase.m; sourceTree = "<group>"; };
CFD6D97A946F2FEF294F4BBB /* Pods_BonMot_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_BonMot_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
EBE7037465B0F6F184875C40 /* Pods-BonMot_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BonMot_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-BonMot_Example/Pods-BonMot_Example.release.xcconfig"; sourceTree = "<group>"; };
EC2F199C1CEA324300D9F1FE /* BONTagDictionaryStylesTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONTagDictionaryStylesTestCase.m; sourceTree = "<group>"; };
EC433DB11C88B65B001B3ABE /* BONTagStylesTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONTagStylesTestCase.m; sourceTree = "<group>"; };
EC2F199C1CEA324300D9F1FE /* BONTagStylesTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONTagStylesTestCase.m; sourceTree = "<group>"; };
EC2F199F1CEBBA9E00D9F1FE /* BONTagTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONTagTestCase.m; sourceTree = "<group>"; };
EC433DB11C88B65B001B3ABE /* BONTagMakeTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONTagMakeTestCase.m; sourceTree = "<group>"; };
EC433DB41C88BBDB001B3ABE /* BONUIKitUtilitiesTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONUIKitUtilitiesTestCase.m; sourceTree = "<group>"; };
EC433DB71C88DE5F001B3ABE /* TagStylesCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagStylesCell.h; sourceTree = "<group>"; };
EC433DB81C88DE5F001B3ABE /* TagStylesCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TagStylesCell.m; sourceTree = "<group>"; };
EC433DBA1C88DEF7001B3ABE /* TagStylesCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TagStylesCell.xib; sourceTree = "<group>"; };
ECD4DB691CE3EA1F00079675 /* BONTagComplexStylesTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONTagComplexStylesTestCase.m; sourceTree = "<group>"; };
ECD4DB691CE3EA1F00079675 /* BONTagComplexMakeTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONTagComplexMakeTestCase.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -290,9 +292,10 @@
CD6DEFDA1BF6ADF900676E2D /* BONDictionaryEqualityTestCase.m */,
730361E11C9B5CD300987809 /* BONHumanReadableStringTestCase.m */,
CD6DEFDB1BF6ADF900676E2D /* BONIndentSpacerTestCase.m */,
EC433DB11C88B65B001B3ABE /* BONTagStylesTestCase.m */,
EC2F199C1CEA324300D9F1FE /* BONTagDictionaryStylesTestCase.m */,
ECD4DB691CE3EA1F00079675 /* BONTagComplexStylesTestCase.m */,
EC2F199C1CEA324300D9F1FE /* BONTagStylesTestCase.m */,
EC433DB11C88B65B001B3ABE /* BONTagMakeTestCase.m */,
ECD4DB691CE3EA1F00079675 /* BONTagComplexMakeTestCase.m */,
EC2F199F1CEBBA9E00D9F1FE /* BONTagTestCase.m */,
CD6DEFDC1BF6ADF900676E2D /* BONPropertyClobberingTestCase.m */,
CD6DEFDD1BF6ADF900676E2D /* BONTextAlignmentConstraintTestCase.m */,
CD6DEFDE1BF6ADF900676E2D /* BONTextAlignmentTestCase.m */,
Expand Down Expand Up @@ -641,16 +644,17 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EC2F199E1CEA324900D9F1FE /* BONTagDictionaryStylesTestCase.m in Sources */,
EC2F199E1CEA324900D9F1FE /* BONTagStylesTestCase.m in Sources */,
EC433DB61C88BBDE001B3ABE /* BONUIKitUtilitiesTestCase.m in Sources */,
EC2F19A11CEBBAF900D9F1FE /* BONTagTestCase.m in Sources */,
CD6DF05A1BF6B98500676E2D /* NSDictionary+BONEquality.m in Sources */,
CD6DF04B1BF6B37E00676E2D /* DummyAssetClass.m in Sources */,
730361E31C9B5CDD00987809 /* BONHumanReadableStringTestCase.m in Sources */,
ECD4DB6B1CE3EA2700079675 /* BONTagComplexStylesTestCase.m in Sources */,
ECD4DB6B1CE3EA2700079675 /* BONTagComplexMakeTestCase.m in Sources */,
CD6DEFED1BF6ADF900676E2D /* BONPropertyClobberingTestCase.m in Sources */,
CD6DEFF11BF6ADF900676E2D /* BONTextAlignmentTestCase.m in Sources */,
CD6DEFE11BF6ADF900676E2D /* BONBaseTestCase.m in Sources */,
EC433DB31C88B7D9001B3ABE /* BONTagStylesTestCase.m in Sources */,
EC433DB31C88B7D9001B3ABE /* BONTagMakeTestCase.m in Sources */,
CDE658581C24ADD8009C7D09 /* BONUnderlineAndStrikethroughTestCase.m in Sources */,
CD6DEFF31BF6ADF900676E2D /* BONTrackingTestCase.m in Sources */,
CD64F15E1CA4DAC800042559 /* BONFigureTestCase.m in Sources */,
Expand Down
Expand Up @@ -28,7 +28,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "83F933DF3E48175891E4EBFC2EDB74A2"
BlueprintIdentifier = "936C2599775DA43BC28A7798C3663474"
BuildableName = "BonMot.framework"
BlueprintName = "BonMot"
ReferencedContainer = "container:Pods/Pods.xcodeproj">
Expand Down
5 changes: 3 additions & 2 deletions Example/BonMot/Cells/TagStylesCell.m
Expand Up @@ -29,8 +29,9 @@ - (void)awakeFromNib
BONChain *italicChain = BONChain.new.fontNameAndSize(@"Baskerville-Italic", 15);

BONChain *baseChain = BONChain.new.fontNameAndSize(@"Baskerville", 17)
.tagStyles(@[ BONTagMake(@"bold", boldChain), BONTagMake(@"italic", italicChain) ])
.string(@"<bold>This text is wrapped in a \\<bold> tag.</bold>\n<italic>This text is wrapped in an \\<italic> tag.</italic>");
.tagStyles(@{ @"bold" : boldChain,
@"italic" : italicChain })
.string(@"<bold>This text</bold> contains a \\<bold> tag.\n<italic>This text</italic> contains an \\<italic> tag.");

self.label.attributedText = baseChain.attributedString;

Expand Down
@@ -1,20 +1,20 @@
//
// BONTagComplexStylingTestCase.m
// BONTagComplexMakeTestCase.m
// BonMot
//
// Created by Nora Trapp on 3/3/16.
//
// Copyright © 2016 Zev Eisenberg. All rights reserved.
//

#import "BONBaseTestCase.h"

@import BonMot;

@interface BONTagComplexStylingTestCase : BONBaseTestCase
@interface BONTagComplexMakeTestCase : BONBaseTestCase

@end

@implementation BONTagComplexStylingTestCase
@implementation BONTagComplexMakeTestCase

- (void)testSingleTagSingleStyle
{
Expand Down Expand Up @@ -373,9 +373,9 @@ - (void)testNestedEscapedEndTag

- (void)testInterleavedEscapedEndTag
{
BONChain *chain = BONChain.new.string(@"qwerty[/b]qwerty[/i]qwerty[/b](i)Helloqwerty[/i][/i], world!")
BONChain *chain = BONChain.new.string(@"qwerty[/b]asdfgh[/i]qwerty[/b](i)Helloasdfgh[/i][/i], world!")
.tagComplexStyles(@[
BONTagComplexMake(@"(i)", @"[/i]", @"qwerty", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagComplexMake(@"(i)", @"[/i]", @"asdfgh", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagComplexMake(@"(b)", @"[/b]", @"qwerty", BONChain.new.font([UIFont boldSystemFontOfSize:16])),
]);

Expand Down
@@ -1,25 +1,25 @@
//
// BONTagDictionaryStylesTestCase.m
// BONTagMakeTestCase.m
// BonMot
//
// Created by Nora Trapp on 5/16/16.
// Created by Nora Trapp on 3/3/16.
// Copyright © 2016 Zev Eisenberg. All rights reserved.
//

#import "BONBaseTestCase.h"

@import BonMot;

@interface BONTagDictionaryStylesTestCase : BONBaseTestCase
@interface BONTagMakeTestCase : BONBaseTestCase

@end

@implementation BONTagDictionaryStylesTestCase
@implementation BONTagMakeTestCase

- (void)testSingleTagSingleStyle
{
BONChain *chain = BONChain.new.string(@"Hello, <i>world</i>!")
.tagStyles(@{ @"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]) });
.tagComplexStyles(@[ BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])) ]);

NSAttributedString *attributedString = chain.attributedString;

Expand Down Expand Up @@ -48,7 +48,7 @@ - (void)testSingleTagSingleStyle
- (void)testMultipleTagsSingleStyle
{
BONChain *chain = BONChain.new.string(@"<i>Hello</i>, <i>world</i>!")
.tagStyles(@{ @"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]) });
.tagComplexStyles(@[ BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])) ]);

NSAttributedString *attributedString = chain.attributedString;

Expand Down Expand Up @@ -82,10 +82,10 @@ - (void)testMultipleTagsSingleStyle
- (void)testSingleTagMultipleStyles
{
BONChain *chain = BONChain.new.string(@"Hello, <b>world</b>!")
.tagStyles(@{
@"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]),
@"b" : BONChain.new.font([UIFont boldSystemFontOfSize:16]),
});
.tagComplexStyles(@[
BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagMake(@"b", BONChain.new.font([UIFont boldSystemFontOfSize:16])),
]);

NSAttributedString *attributedString = chain.attributedString;

Expand Down Expand Up @@ -114,10 +114,10 @@ - (void)testSingleTagMultipleStyles
- (void)testMultipleTagsMultipleStyles
{
BONChain *chain = BONChain.new.string(@"<b>Hello</b>, <i>world</i>!")
.tagStyles(@{
@"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]),
@"b" : BONChain.new.font([UIFont boldSystemFontOfSize:16]),
});
.tagComplexStyles(@[
BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagMake(@"b", BONChain.new.font([UIFont boldSystemFontOfSize:16])),
]);

NSAttributedString *attributedString = chain.attributedString;

Expand Down Expand Up @@ -151,10 +151,10 @@ - (void)testMultipleTagsMultipleStyles
- (void)testInterleavedTags
{
BONChain *chain = BONChain.new.string(@"<b>Hello<i></b>, world</i>!")
.tagStyles(@{
@"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]),
@"b" : BONChain.new.font([UIFont boldSystemFontOfSize:16]),
});
.tagComplexStyles(@[
BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagMake(@"b", BONChain.new.font([UIFont boldSystemFontOfSize:16])),
]);

NSAttributedString *attributedString = chain.attributedString;

Expand All @@ -179,10 +179,10 @@ - (void)testInterleavedTags
- (void)testNestedTags
{
BONChain *chain = BONChain.new.string(@"<b><i>Hello</i></b>, world!")
.tagStyles(@{
@"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]),
@"b" : BONChain.new.font([UIFont boldSystemFontOfSize:16]),
});
.tagComplexStyles(@[
BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagMake(@"b", BONChain.new.font([UIFont boldSystemFontOfSize:16])),
]);

NSAttributedString *attributedString = chain.attributedString;

Expand All @@ -207,10 +207,10 @@ - (void)testNestedTags
- (void)testMixedOrdering
{
BONChain *chain = BONChain.new.string(@"<b>Hel</b><i>lo</i>, <b>wor</b><i>ld!</i>")
.tagStyles(@{
@"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]),
@"b" : BONChain.new.font([UIFont boldSystemFontOfSize:16]),
});
.tagComplexStyles(@[
BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagMake(@"b", BONChain.new.font([UIFont boldSystemFontOfSize:16])),
]);

NSAttributedString *attributedString = chain.attributedString;

Expand Down Expand Up @@ -250,10 +250,10 @@ - (void)testMixedOrdering
- (void)testEscapedStartTag
{
BONChain *chain = BONChain.new.string(@"\\<b><b>Hello</b>, world!")
.tagStyles(@{
@"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]),
@"b" : BONChain.new.font([UIFont boldSystemFontOfSize:16]),
});
.tagComplexStyles(@[
BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagMake(@"b", BONChain.new.font([UIFont boldSystemFontOfSize:16])),
]);

NSAttributedString *attributedString = chain.attributedString;

Expand Down Expand Up @@ -282,10 +282,10 @@ - (void)testEscapedStartTag
- (void)testMultipleEscapedStartTag
{
BONChain *chain = BONChain.new.string(@"\\<b><b>Hello</b>\\<b>, world!")
.tagStyles(@{
@"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]),
@"b" : BONChain.new.font([UIFont boldSystemFontOfSize:16]),
});
.tagComplexStyles(@[
BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagMake(@"b", BONChain.new.font([UIFont boldSystemFontOfSize:16])),
]);

NSAttributedString *attributedString = chain.attributedString;

Expand Down Expand Up @@ -314,10 +314,10 @@ - (void)testMultipleEscapedStartTag
- (void)testMultipleEscapedEndTag
{
BONChain *chain = BONChain.new.string(@"\\</b><b>Hello</b>\\</b>, world!")
.tagStyles(@{
@"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]),
@"b" : BONChain.new.font([UIFont boldSystemFontOfSize:16]),
});
.tagComplexStyles(@[
BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagMake(@"b", BONChain.new.font([UIFont boldSystemFontOfSize:16])),
]);

NSAttributedString *attributedString = chain.attributedString;

Expand Down Expand Up @@ -346,10 +346,10 @@ - (void)testMultipleEscapedEndTag
- (void)testNestedEscapedEndTag
{
BONChain *chain = BONChain.new.string(@"<b>Hello\\</b></b>, world!")
.tagStyles(@{
@"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]),
@"b" : BONChain.new.font([UIFont boldSystemFontOfSize:16]),
});
.tagComplexStyles(@[
BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagMake(@"b", BONChain.new.font([UIFont boldSystemFontOfSize:16])),
]);

NSAttributedString *attributedString = chain.attributedString;

Expand All @@ -374,10 +374,10 @@ - (void)testNestedEscapedEndTag
- (void)testInterleavedEscapedEndTag
{
BONChain *chain = BONChain.new.string(@"\\</b>\\</i>\\</b><i>Hello\\</i></i>, world!")
.tagStyles(@{
@"i" : BONChain.new.font([UIFont italicSystemFontOfSize:16]),
@"b" : BONChain.new.font([UIFont boldSystemFontOfSize:16]),
});
.tagComplexStyles(@[
BONTagMake(@"i", BONChain.new.font([UIFont italicSystemFontOfSize:16])),
BONTagMake(@"b", BONChain.new.font([UIFont boldSystemFontOfSize:16])),
]);

NSAttributedString *attributedString = chain.attributedString;

Expand Down

0 comments on commit b8ea5ba

Please sign in to comment.