You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
angularjs-batarang/panel/components/json-tree/json-tree.spec.js

34 lines
755 B
JavaScript

'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);
}
});