Skip to content

Commit

Permalink
Added Droplet.METHOD object
Browse files Browse the repository at this point in the history
  • Loading branch information
Wildhoney committed Oct 15, 2015
1 parent 96dbe53 commit 0418a77
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -83,7 +83,7 @@ options object:
```javascript
App.XDropletComponent = Ember.Component.extend(Droplet, {
options: {
requestMethod: "PATCH"
requestMethod: Droplet.METHOD.PATCH
// ...
}
});
Expand Down
14 changes: 13 additions & 1 deletion components/Droplet.js
Expand Up @@ -11,6 +11,12 @@
*/
const STATUS_TYPES = { NONE: 0, VALID: 1, INVALID: 2, DELETED: 4, UPLOADED: 8, FAILED: 16 };

/**
* @constant REQUEST_METHODS
* @type {{PATCH: string, POST: string, PUT: string}}
*/
const REQUEST_METHODS = { PATCH: 'PATCH', POST: 'POST', PUT: 'PUT' };

/**
* @constant EVENT_NAME
* @type {String}
Expand Down Expand Up @@ -142,7 +148,7 @@
* @property requestMethod
* @type {String}
*/
requestMethod: 'POST',
requestMethod: REQUEST_METHODS.POST,

/**
* @property maximumSize
Expand Down Expand Up @@ -904,4 +910,10 @@
multiple: false
});

/**
* @constant $window.Droplet.METHOD
* @type {Object}
*/
$window.Droplet.METHOD = REQUEST_METHODS;

})(window, window.Ember, window.FileReader);
14 changes: 13 additions & 1 deletion dist/ember-droplet.js
Expand Up @@ -23,6 +23,12 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
*/
var STATUS_TYPES = { NONE: 0, VALID: 1, INVALID: 2, DELETED: 4, UPLOADED: 8, FAILED: 16 };

/**
* @constant REQUEST_METHODS
* @type {{PATCH: string, POST: string, PUT: string}}
*/
var REQUEST_METHODS = { PATCH: 'PATCH', POST: 'POST', PUT: 'PUT' };

/**
* @constant EVENT_NAME
* @type {String}
Expand Down Expand Up @@ -155,7 +161,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
* @property requestMethod
* @type {String}
*/
requestMethod: 'POST',
requestMethod: REQUEST_METHODS.POST,

/**
* @property maximumSize
Expand Down Expand Up @@ -975,4 +981,10 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
$window.Droplet.SingleInput = Mixin.create($window.Droplet.MultipleInput, {
multiple: false
});

/**
* @constant $window.Droplet.METHOD
* @type {Object}
*/
$window.Droplet.METHOD = REQUEST_METHODS;
})(window, window.Ember, window.FileReader);
2 changes: 1 addition & 1 deletion dist/ember-droplet.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/DropletOptions.test.js
Expand Up @@ -19,8 +19,8 @@ describe('Ember Droplet: Options', () => {
expect(component.get('options.mimeTypes.length')).toEqual(defaultMimeTypesLength + 1);
expect(component.get('options.mimeTypes')[defaultMimeTypesLength]).toEqual('application/pdf');

component.set('options.requestMethod', 'GET');
expect(component.get('options.requestMethod')).toEqual('GET');
component.set('options.requestMethod', Droplet.METHOD.PATCH);
expect(component.get('options.requestMethod')).toEqual('PATCH');

component.set('options.maximumSize', 4000);
expect(component.get('options.maximumSize')).toEqual(4000);
Expand Down

0 comments on commit 0418a77

Please sign in to comment.