-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2283 from arthurevans/timob-9222
[TIMOB-9222][TIMOB-9223] Clipboard fixes in honor of Hal.
- Loading branch information
Showing
3 changed files
with
72 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
describe("Ti.UI.Clipboard tests", { | ||
setAndGetText: function() { | ||
Ti.UI.Clipboard.setText('hello'); | ||
valueOf(Ti.UI.Clipboard.hasText()).shouldBeTrue(); | ||
valueOf(Ti.UI.Clipboard.getText()).shouldBe('hello'); | ||
}, | ||
|
||
clearText: function() { | ||
valueOf(function() { | ||
Ti.UI.Clipboard.clearText(); | ||
}).shouldNotThrowException(); | ||
valueOf(Ti.UI.Clipboard.hasText()).shouldBeFalse(); | ||
// Return value of getText() varies by platform: TIMOB-9224 | ||
// So we can't test it, but at least it shouldn't throw an exception. | ||
valueOf(function() { | ||
Ti.UI.Clipboard.getText(); | ||
}).shouldNotThrowException(); | ||
}, | ||
|
||
// Using setData to store text with a mime type. | ||
setAndGetHTML: function() { | ||
// Clear all data first. | ||
Ti.UI.Clipboard.clearData(); | ||
Ti.UI.Clipboard.setData('text/html', "<p>How is <em>this</em> for data?</p>"); | ||
valueOf(Ti.UI.Clipboard.hasData('text/html')).shouldBeTrue(); | ||
valueOf(Ti.UI.Clipboard.getData('text/html')) | ||
.shouldBe("<p>How is <em>this</em> for data?</p>"); | ||
}, | ||
|
||
// Data with mimeType 'text/url-list' or 'url' is treated as a URL on iOS, so | ||
// follows a different code path than plain text or images. | ||
urlData: function() { | ||
Ti.UI.Clipboard.clearData(); | ||
Ti.UI.Clipboard.setData('text/url-list', "http://www.appcelerator.com"); | ||
valueOf(Ti.UI.Clipboard.getData('text/url-list')).shouldBe("http://www.appcelerator.com"); | ||
} | ||
|
||
}); |
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