2018-06-15 23:03:24 +08:00
|
|
|
import Theme from "admin/models/theme";
|
2017-05-10 05:20:28 +08:00
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.module("model:theme");
|
2017-05-10 05:20:28 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
QUnit.test("can add an upload correctly", function(assert) {
|
2017-05-10 05:20:28 +08:00
|
|
|
let theme = Theme.create();
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.equal(
|
|
|
|
theme.get("uploads.length"),
|
|
|
|
0,
|
|
|
|
"uploads should be an empty array"
|
|
|
|
);
|
2017-05-10 05:20:28 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
theme.setField("common", "bob", "", 999, 2);
|
2017-05-10 05:20:28 +08:00
|
|
|
let fields = theme.get("theme_fields");
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.equal(fields.length, 1, "expecting 1 theme field");
|
|
|
|
assert.equal(fields[0].upload_id, 999, "expecting upload id to be set");
|
|
|
|
assert.equal(fields[0].type_id, 2, "expecting type id to be set");
|
2017-05-10 05:20:28 +08:00
|
|
|
|
|
|
|
assert.equal(theme.get("uploads.length"), 1, "expecting an upload");
|
2018-06-15 23:03:24 +08:00
|
|
|
});
|