This repository has been archived on 2020-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
angularjs-batarang/panel/components/json-tree/json-tree.spec.js

34 lines
754 B
JavaScript
Raw Normal View History

'use strict';
describe('batJsonTree', function () {
var $compile, $rootScope, element;
beforeEach(module('batarang.json-tree'));
beforeEach(inject(function (_$compile_, _$rootScope_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
}));
it('should not throw on an undefined model', function () {
expect(compileTree).not.toThrow();
});
it('should render a simple model', function () {
$rootScope.data = {
'': { '$id': 1 }
}
compileTree();
expect(element.text()).toBe('$id: 1');
});
function compileTree() {
element = compile('<bat-json-tree bat-model="data"></bat-json-tree>');
$rootScope.$apply();
}
function compile(template) {
return $compile(template)($rootScope);
}
});