Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
qunit.ok(account.db === db, "created account has correct db");
qunit.ok(account.parent === db.getRealRoot(), "created account top as parent");
qunit.ok(account.children.size == 0, "created account has no children");
var account1_guid = account.data.guid;
var sub = db.createAccount(act({"name":"Sub", "parent_guid":account1_guid}));
qunit.ok(sub, "create account 2");
qunit.ok(account.children.size == 1, "now Test account has sub-account");
// Move account to the top level.
sub.update(act({"name":"Sub"}));
qunit.ok(db.getRealRoot().children.size == 2, "top-level now has two accounts");
qunit.ok(account.children.size == 0, "Test no longer has sub-account");
throws(function() {
db.createAccount(act({"name":"Test"}))
}, "can't create account with duplicate name");
qunit.ok(db.createAccount(act({ "guid": "EXPLICIT GUID", "name": "YO"})),
"can create an account with an explicit GUID set.");
});
window.MediaSource.isTypeSupported = function(mime) {
return true;
};
QUnit.ok(
new videojs.MediaSource({ mode: 'flash' }) instanceof FlashMediaSource,
'forced flash'
);
QUnit.ok(
new videojs.MediaSource({ mode: 'html5' }) instanceof HtmlMediaSource,
'forced html5'
);
// 'auto' should use native mediasources when they're available
QUnit.ok(
new videojs.MediaSource() instanceof HtmlMediaSource,
'used html5'
);
window.MediaSource.isTypeSupported = function(mime) {
return false;
};
// 'auto' should use flash when native mediasources are not available
QUnit.ok(
new videojs.MediaSource() instanceof FlashMediaSource,
'used flash'
);
});
q.test("tags", function () {
q.expect(2);
q.ok(Array.isArray(this.params), "parameters exist");
q.strictEqual(this.params.length, 5, "number of parameters");
});
q.test("kind", function () {
q.expect(4);
q.ok(this.Foo1.classDoclet, "Foo1 has a class doclet");
q.strictEqual(this.Foo1.classDoclet.kind, "class", "Foo1 is a class");
q.ok(this.Foo2.classDoclet, "Foo2 has a class doclet");
q.strictEqual(this.Foo2.classDoclet.kind, "class", "Foo2 is a class");
});
q.test("scope", function () {
q.expect(6);
q.ok(this.decls, "global decls");
q.strictEqual(Object.keys(this.decls).length, 2, "number of namespaces");
q.ok(this.Foo1, "Foo1 exists");
q.ok(this.Foo1 instanceof jfdoc.Scope, "Foo1 is a scope");
q.ok(this.Foo2, "Foo2 exists");
q.ok(this.Foo2 instanceof jfdoc.Scope, "Foo2 is a scope");
});
q.test("scope", function () {
q.expect(6);
q.ok(this.decls, "global decls");
q.strictEqual(Object.keys(this.decls).length, 2, "number of namespaces");
q.ok(this.Foo1, "Foo1 exists");
q.ok(this.Foo1 instanceof jfdoc.Scope, "Foo1 is a scope");
q.ok(this.Foo2, "Foo2 exists");
q.ok(this.Foo2 instanceof jfdoc.Scope, "Foo2 is a scope");
});
q.test("scope", function () {
q.expect(5);
q.strictEqual(Object.keys(this.decls).length, 2, "number of classes");
q.ok(this.Foo1, "Foo1 exists");
q.ok(this.Foo1 instanceof jfdoc.Scope, "Foo1 is a scope");
q.ok(this.Foo2, "Foo2 exists");
q.ok(this.Foo2 instanceof jfdoc.Scope, "Foo2 is a scope");
});
var notified3 = 0;
var testAccount = db.getRealRoot().children.get("Test");
qunit.ok(testAccount);
var testAccountGuid = testAccount.data.guid;
testAccount.subscribe(this, function() {
notified3 += 1;
});
db.createAccount(act({"name":"Sub", "parent_guid":testAccountGuid}));
var sub = testAccount.children.get("Sub");
qunit.ok(sub);
equal(notified3, 1);
equal(notified2, 1);
equal(notified, 2);
qunit.ok(db.createAccount(act({"name":"Test5"})), "create account 5");
equal(notified3, 1);
equal(notified2, 2);
equal(notified, 2);
var notified4 = 0;
var subscriber2 = {};
db.getRealRoot().subscribe(subscriber2, function() {
notified4 += 1;
});
qunit.ok(db.createAccount(act({"name":"Test6"})), "create account 6");
equal(notified4, 1);
equal(notified3, 1);
equal(notified2, 3);
equal(notified, 2);
qunit.ok(db.createAccount(act({"name":"Test6"})), "create account 6");
equal(notified4, 1);
equal(notified3, 1);
equal(notified2, 3);
equal(notified, 2);
sub.update(act({"name": "WasSub"}))
equal(notified4, 2);
equal(notified3, 2);
equal(notified2, 4);
equal(notified, 2);
db.getRealRoot().unsubscribe(this);
testAccount.unsubscribe(this);
qunit.ok(db.createAccount(act({"name":"Test7"})), "create account 7");
equal(notified4, 3);
equal(notified3, 2);
equal(notified2, 4);
equal(notified, 2);
});
model.DB.open().then(function(db) {
qunit.ok(false);
done();
}, function() {
err = true;