-
Notifications
You must be signed in to change notification settings - Fork 282
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 #282 from alexindigo/master
#271 Added check for self and window objects + tests
- Loading branch information
Showing
5 changed files
with
26 additions
and
8 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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
/* eslint-env browser */ | ||
module.exports = self.FormData; | ||
module.exports = typeof self == 'object' ? self.FormData : window.FormData; |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var test = require('tape'); | ||
var FormData = require('../lib/browser.js'); | ||
var form = new FormData(); | ||
|
||
test('being nice to browser-like environments', function(t) | ||
{ | ||
t.plan(3); | ||
t.notEqual(typeof FormData, 'undefined', 'FormData should be defined'); | ||
t.equal(typeof form, 'object', 'FormData instance should be object'); | ||
t.equal(typeof form.append, 'function', 'FormData instance should have `append` method'); | ||
}); |