Skip to content

Commit

Permalink
Add some tests on Float field
Browse files Browse the repository at this point in the history
  • Loading branch information
jpetitcolas committed May 29, 2015
1 parent 7e5e4b8 commit 77d631b
Show file tree
Hide file tree
Showing 9 changed files with 163,769 additions and 145 deletions.
435 changes: 434 additions & 1 deletion build/ng-admin-only.min.css

Large diffs are not rendered by default.

70,942 changes: 70,913 additions & 29 deletions build/ng-admin-only.min.js

Large diffs are not rendered by default.

8,854 changes: 8,852 additions & 2 deletions build/ng-admin.min.css

Large diffs are not rendered by default.

83,584 changes: 83,525 additions & 59 deletions build/ng-admin.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"npm": "^2.10.0"
},
"devDependencies": {
"admin-config": "^0.1.1",
"admin-config": "git+https://github.com/marmelab/admin-config.git#0.1.2",
"angular": "^1.3.15",
"angular-bootstrap": "^0.12.0",
"angular-file-upload": "^1.6.4",
Expand Down
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/config/factories.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function factories(fvp) {
fvp.registerFieldView('datetime', require('../fieldView/DateFieldView'));
fvp.registerFieldView('email', require('../fieldView/EmailFieldView'));
fvp.registerFieldView('file', require('../fieldView/FileFieldView'));
fvp.registerFieldView('float', require('ng-admin/Crud/fieldView/FloatFieldView'));
fvp.registerFieldView('float', require('../fieldView/FloatFieldView'));
fvp.registerFieldView('json', require('../fieldView/JsonFieldView'));
fvp.registerFieldView('number', require('../fieldView/NumberFieldView'));
fvp.registerFieldView('password', require('../fieldView/PasswordFieldView'));
Expand Down
30 changes: 11 additions & 19 deletions src/javascripts/ng-admin/Crud/fieldView/FloatFieldView.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
define(function(require) {
"use strict";

function getReadWidget() {
return '<ma-number-column field="::field" value="::entry.values[field.name()]"></ma-float-column>';
}
function getLinkWidget() {
return '<a ng-click="gotoDetail()">' + getReadWidget() + '</a>';
}
function getFilterWidget() {
module.exports = {
getReadWidget: function() {
return '<ma-number-column field="::field" value="::entry.values[field.name()]"></ma-number-column>';
},
getLinkWidget: function() {
return '<a ng-click="gotoDetail()">' + this.getReadWidget() + '</a>';
},
getFilterWidget: function() {
return '<ma-input-field type="number" step="any" field="::field" value="values[field.name()]"></ma-input-field>';
}
function getWriteWidget() {
},
getWriteWidget: function() {
return '<ma-input-field type="number" step="any" field="::field" value="entry.values[field.name()]"></ma-input-field>';
}
return {
getReadWidget: getReadWidget,
getLinkWidget: getLinkWidget,
getFilterWidget: getFilterWidget,
getWriteWidget: getWriteWidget
}
});
};
33 changes: 0 additions & 33 deletions src/javascripts/ng-admin/Main/config/factories.js

This file was deleted.

32 changes: 32 additions & 0 deletions src/javascripts/test/unit/Crud/fieldView/FloatFieldView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
var assert = require('chai').assert;
var FloatFieldView = require('../../../../ng-admin/Crud/fieldView/FloatFieldView');

describe('FloatFieldView', function() {
describe('getReadWidget', function() {
it('should return number column directive', function() {
var widget = FloatFieldView.getReadWidget();
assert.include(widget, '<ma-number-column');
});
});

describe('getLinkWidget', function() {
it('should return number column directive', function() {
var widget = FloatFieldView.getLinkWidget();
assert.include(widget, '<ma-number-column');
});
});

describe('getFilterWidget', function() {
it('should set step attribute to "any"', function() {
var widget = FloatFieldView.getFilterWidget();
assert.include(widget, 'step="any"');
});
});

describe('getWriteWidget', function() {
it('should set step attribute to "any"', function() {
var widget = FloatFieldView.getFilterWidget();
assert.include(widget, 'step="any"');
});
});
});

0 comments on commit 77d631b

Please sign in to comment.