Skip to content

Commit 689537c

Browse files
committed
tests: remove duplicate sf-schema tests
1 parent 104a3fa commit 689537c

File tree

1 file changed

+0
-191
lines changed

1 file changed

+0
-191
lines changed

src/directives/sf-schema.directive.spec.js

-191
Original file line numberDiff line numberDiff line change
@@ -2217,197 +2217,6 @@ describe('sf-schema.directive.js', function() {
22172217
});
22182218
});
22192219

2220-
it('should not add "has-success" class to radios field if a correct value is entered, but disableSuccessState is set on form', function () {
2221-
var field = {
2222-
name: 'radios',
2223-
property: {
2224-
type: 'boolean',
2225-
},
2226-
form: {
2227-
key: ["field"],
2228-
type: "radios",
2229-
titleMap: [
2230-
{
2231-
"value": false,
2232-
"name": "No way"
2233-
},
2234-
{
2235-
"value": true,
2236-
"name": "OK"
2237-
}
2238-
]
2239-
}
2240-
};
2241-
2242-
inject(function($compile, $rootScope) {
2243-
var scope = $rootScope.$new();
2244-
scope.model = {}
2245-
scope.schema = {
2246-
type: 'object',
2247-
properties: {
2248-
field: field.property
2249-
}
2250-
};
2251-
scope.form = [field.form];
2252-
2253-
var tmpl = angular.element('<form name="theForm" sf-schema="schema" sf-form="form" sf-model="model"></form>');
2254-
$compile(tmpl)(scope);
2255-
runSync(scope, tmpl);
2256-
var ngModelCtrl = tmpl.find('.field').scope().ngModel;
2257-
ngModelCtrl.$valid = true;
2258-
ngModelCtrl.$pristine = false;
2259-
$rootScope.$apply();
2260-
tmpl.find('.field').hasClass('has-success').should.be.true;
2261-
scope.form[0].disableSuccessState = true;
2262-
$rootScope.$apply();
2263-
tmpl.find('.field').hasClass('has-success').should.be.false;
2264-
});
2265-
});
2266-
2267-
it('should not add "has-error" class to radios field if invalid value is entered, but disableErrorState is set on form', function () {
2268-
var field = {
2269-
name: 'radios',
2270-
property: {
2271-
type: 'boolean',
2272-
},
2273-
form: {
2274-
key: ["field"],
2275-
type: "radios",
2276-
titleMap: [
2277-
{
2278-
"value": false,
2279-
"name": "No way"
2280-
},
2281-
{
2282-
"value": true,
2283-
"name": "OK"
2284-
}
2285-
]
2286-
}
2287-
};
2288-
2289-
inject(function($compile, $rootScope) {
2290-
var scope = $rootScope.$new();
2291-
scope.model = {
2292-
field: field.errorValue
2293-
}
2294-
scope.schema = {
2295-
type: 'object',
2296-
properties: {
2297-
field: field.property
2298-
}
2299-
};
2300-
scope.form = [field.form];
2301-
2302-
var tmpl = angular.element('<form name="theForm" sf-schema="schema" sf-form="form" sf-model="model"></form>');
2303-
$compile(tmpl)(scope);
2304-
runSync(scope, tmpl);
2305-
var ngModelCtrl = tmpl.find('.field').scope().ngModel;
2306-
ngModelCtrl.$invalid = true;
2307-
ngModelCtrl.$pristine = false;
2308-
$rootScope.$apply();
2309-
tmpl.find('.field').hasClass('has-error').should.be.true;
2310-
scope.form[0].disableErrorState = true;
2311-
$rootScope.$apply();
2312-
tmpl.find('.field').hasClass('has-error').should.be.false;
2313-
});
2314-
});
2315-
2316-
it('should not add "has-success" class to radios-inline field if a correct value is entered, but disableSuccessState is set on form', function () {
2317-
var field = {
2318-
name: 'radios',
2319-
property: {
2320-
type: 'boolean',
2321-
},
2322-
form: {
2323-
key: ["field"],
2324-
type: "radios",
2325-
titleMap: [
2326-
{
2327-
"value": false,
2328-
"name": "No way"
2329-
},
2330-
{
2331-
"value": true,
2332-
"name": "OK"
2333-
}
2334-
]
2335-
}
2336-
};
2337-
2338-
inject(function($compile, $rootScope) {
2339-
var scope = $rootScope.$new();
2340-
scope.model = {}
2341-
scope.schema = {
2342-
type: 'object',
2343-
properties: {
2344-
field: field.property
2345-
}
2346-
};
2347-
scope.form = [field.form];
2348-
2349-
var tmpl = angular.element('<form name="theForm" sf-schema="schema" sf-form="form" sf-model="model"></form>');
2350-
$compile(tmpl)(scope);
2351-
runSync(scope, tmpl);
2352-
var ngModelCtrl = tmpl.find('.field').scope().ngModel;
2353-
ngModelCtrl.$valid = true;
2354-
ngModelCtrl.$pristine = false;
2355-
$rootScope.$apply();
2356-
tmpl.find('.field').hasClass('has-success').should.be.true;
2357-
scope.form[0].disableSuccessState = true;
2358-
$rootScope.$apply();
2359-
tmpl.find('.field').hasClass('has-success').should.be.false;
2360-
});
2361-
});
2362-
2363-
it('should not add "has-error" class to radios-inline field if invalid value is entered, but disableErrorState is set on form', function () {
2364-
var field = {
2365-
name: 'radios',
2366-
property: {
2367-
type: 'boolean',
2368-
},
2369-
form: {
2370-
key: ["field"],
2371-
type: "radios",
2372-
titleMap: [
2373-
{
2374-
"value": false,
2375-
"name": "No way"
2376-
},
2377-
{
2378-
"value": true,
2379-
"name": "OK"
2380-
}
2381-
]
2382-
}
2383-
};
2384-
2385-
inject(function($compile, $rootScope) {
2386-
var scope = $rootScope.$new();
2387-
scope.model = {
2388-
field: field.errorValue
2389-
}
2390-
scope.schema = {
2391-
type: 'object',
2392-
properties: {
2393-
field: { type: 'boolean' }
2394-
}
2395-
};
2396-
scope.form = [field.form];
2397-
2398-
var tmpl = angular.element('<form name="theForm" sf-schema="schema" sf-form="form" sf-model="model"></form>');
2399-
$compile(tmpl)(scope);
2400-
runSync(scope, tmpl);
2401-
var ngModelCtrl = tmpl.find('.field').scope().ngModel;
2402-
ngModelCtrl.$invalid = true;
2403-
ngModelCtrl.$pristine = false;
2404-
$rootScope.$apply();
2405-
tmpl.find('.field').hasClass('has-error').should.be.true;
2406-
scope.form[0].disableErrorState = true;
2407-
$rootScope.$apply();
2408-
tmpl.find('.field').hasClass('has-error').should.be.false;
2409-
});
2410-
});
24112220
/*
24122221
TODO
24132222
it('should handle onChange for array type', function () {

0 commit comments

Comments
 (0)