-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
328 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
aem-library-api/src/main/java/com/icfolson/aem/library/api/link/Link.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,6 +173,7 @@ class DefaultLinkBuilderSpec extends AemLibrarySpec { | |
|
||
builder.extension = extension | ||
builder.suffix = suffix | ||
builder.scheme = scheme | ||
builder.host = host | ||
builder.port = port | ||
builder.secure = secure | ||
|
@@ -183,16 +184,18 @@ class DefaultLinkBuilderSpec extends AemLibrarySpec { | |
link.href == href | ||
|
||
where: | ||
extension | suffix | host | port | secure | href | ||
null | "" | "localhost" | 0 | false | "http://localhost/content.html" | ||
null | "/suffix" | "localhost" | 0 | false | "http://localhost/content.html/suffix" | ||
"" | "" | "localhost" | 0 | false | "http://localhost/content" | ||
"" | "/suffix" | "localhost" | 0 | false | "http://localhost/content/suffix" | ||
"html" | "" | "localhost" | 0 | false | "http://localhost/content.html" | ||
"html" | "/suffix" | "localhost" | 0 | false | "http://localhost/content.html/suffix" | ||
"json" | "" | "localhost" | 0 | false | "http://localhost/content.json" | ||
null | "" | "localhost" | 4502 | false | "http://localhost:4502/content.html" | ||
null | "" | "localhost" | 0 | true | "https://localhost/content.html" | ||
extension | suffix | scheme | host | port | secure | href | ||
null | "" | null | "localhost" | 0 | false | "http://localhost/content.html" | ||
null | "/suffix" | null | "localhost" | 0 | false | "http://localhost/content.html/suffix" | ||
"" | "" | null | "localhost" | 0 | false | "http://localhost/content" | ||
"" | "/suffix" | null | "localhost" | 0 | false | "http://localhost/content/suffix" | ||
"html" | "" | null | "localhost" | 0 | false | "http://localhost/content.html" | ||
"html" | "/suffix" | null | "localhost" | 0 | false | "http://localhost/content.html/suffix" | ||
"json" | "" | null | "localhost" | 0 | false | "http://localhost/content.json" | ||
null | "" | null | "localhost" | 4502 | false | "http://localhost:4502/content.html" | ||
null | "" | null | "localhost" | 0 | true | "https://localhost/content.html" | ||
null | "" | "ftp" | "localhost" | 0 | false | "ftp://localhost/content.html" | ||
null | "" | "ftp" | "localhost" | 0 | true | "ftp://localhost/content.html" | ||
} | ||
|
||
def "build link and set external"() { | ||
|
@@ -227,6 +230,45 @@ class DefaultLinkBuilderSpec extends AemLibrarySpec { | |
"http://www.reddit.com" | ["a", "b"] | "http://www.reddit.com" | ||
} | ||
|
||
def "build link for path with scheme"() { | ||
setup: | ||
def link = LinkBuilderFactory.forPath(path) | ||
.setScheme(scheme) | ||
.setOpaque(opaque) | ||
.build() | ||
|
||
expect: | ||
link.href == href | ||
|
||
where: | ||
path | scheme | opaque | href | ||
"/content" | "http" | false | "/content.html" | ||
"+48957228989" | "tel" | true | "tel:+48957228989" | ||
"http://www.reddit.com" | "" | false | "http://www.reddit.com" | ||
"http://www.reddit.com" | "" | true | "http://www.reddit.com" | ||
"https://reddit.com" | "ftp" | true | "ftp:https://reddit.com" | ||
"https://reddit.com" | "ftp" | false | "ftp://https://reddit.com" | ||
"[email protected]" | "mailto" | true | "mailto:[email protected]" | ||
} | ||
|
||
def "build link for link and set protocol"() { | ||
setup: | ||
def link = LinkBuilderFactory.forPath(path).build() | ||
|
||
expect: | ||
LinkBuilderFactory.forLink(link).setScheme(scheme).setOpaque(opaque).build().href == href | ||
|
||
where: | ||
path | scheme | opaque | href | ||
"/content" | "http" | false | "/content.html" | ||
"+48957228989" | "tel" | true | "tel:+48957228989" | ||
"http://www.reddit.com" | "" | false | "http://www.reddit.com" | ||
"http://www.reddit.com" | "" | true | "http://www.reddit.com" | ||
"www.reddit.com" | "https" | false | "https://www.reddit.com" | ||
"https://reddit.com" | "ftp" | true | "ftp:https://reddit.com" | ||
"[email protected]" | "mailto" | true | "mailto:[email protected]" | ||
} | ||
|
||
def "build link for path with parameters"() { | ||
setup: | ||
def link = LinkBuilderFactory.forPath("/content").addParameters(parameters).build() | ||
|
Oops, something went wrong.