This commit is contained in:
parent
a7c48b6ddc
commit
d1f0557923
|
@ -23,7 +23,6 @@ export function directive($translate, $window) {
|
|||
let rule = $attrs.rule.split('.');
|
||||
let modelName = rule.shift();
|
||||
let fieldName = rule.shift();
|
||||
let modelAlias = $attrs.ruleAlias;
|
||||
let split = $attrs.ngModel.split('.');
|
||||
if (!fieldName) fieldName = split.pop() || null;
|
||||
if (!modelName) modelName = firstUpper(split.pop() || '');
|
||||
|
@ -31,12 +30,8 @@ export function directive($translate, $window) {
|
|||
if (!modelName || !fieldName)
|
||||
throw new Error(`rule: Cannot retrieve model or field attribute`);
|
||||
|
||||
|
||||
let modelValidations = vnValidations[modelName];
|
||||
|
||||
if (!modelValidations)
|
||||
modelValidations = vnValidations[modelAlias];
|
||||
|
||||
if (!modelValidations)
|
||||
throw new Error(`rule: Model '${modelName}' doesn't exist`);
|
||||
|
||||
|
|
|
@ -14,15 +14,13 @@
|
|||
<vn-textfield
|
||||
label="Name"
|
||||
ng-model="$ctrl.role.name"
|
||||
rule
|
||||
rule-alias="VnRole"
|
||||
rule="VnRole.name"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
label="Description"
|
||||
ng-model="$ctrl.role.description"
|
||||
rule
|
||||
rule-alias="VnRole"
|
||||
rule="VnRole.description"
|
||||
>
|
||||
</vn-textfield>
|
||||
</vn-vertical>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import './index';
|
||||
|
||||
describe('component vnRoleCard', () => {
|
||||
fdescribe('component vnRoleCard', () => {
|
||||
let controller;
|
||||
let $httpBackend;
|
||||
|
||||
|
@ -15,7 +15,7 @@ describe('component vnRoleCard', () => {
|
|||
it('should reload the controller data', () => {
|
||||
controller.$params.id = 1;
|
||||
|
||||
$httpBackend.expectGET('Roles/1').respond('foo');
|
||||
$httpBackend.expectGET('VnRoles/1').respond('foo');
|
||||
controller.reload();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import './index';
|
||||
|
||||
describe('component vnRoleDescriptor', () => {
|
||||
fdescribe('component vnRoleDescriptor', () => {
|
||||
let controller;
|
||||
let $httpBackend;
|
||||
|
||||
|
@ -18,7 +18,7 @@ describe('component vnRoleDescriptor', () => {
|
|||
controller.$state.go = jest.fn();
|
||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||
|
||||
$httpBackend.expectDELETE('Roles/1').respond();
|
||||
$httpBackend.expectDELETE('VnRoles/1').respond();
|
||||
controller.onDelete();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
Loading…
Reference in New Issue