A fork of https://github.com/ueokande/vim-vixen
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.5 KiB
55 lines
1.5 KiB
5 years ago
|
import Settings from '../../../src/shared/settings/Settings';
|
||
|
import { expect } from 'chai';
|
||
6 years ago
|
|
||
|
describe('Settings', () => {
|
||
|
describe('#valueOf', () => {
|
||
|
it('returns settings by valid settings', () => {
|
||
5 years ago
|
let x = Settings.fromJSON({
|
||
6 years ago
|
keymaps: {},
|
||
|
"search": {
|
||
|
"default": "google",
|
||
|
"engines": {
|
||
|
"google": "https://google.com/search?q={}",
|
||
|
}
|
||
|
},
|
||
|
"properties": {},
|
||
|
"blacklist": []
|
||
|
});
|
||
|
|
||
5 years ago
|
expect({
|
||
|
keymaps: x.keymaps.toJSON(),
|
||
5 years ago
|
search: x.search.toJSON(),
|
||
5 years ago
|
properties: x.properties.toJSON(),
|
||
5 years ago
|
blacklist: x.blacklist.toJSON(),
|
||
5 years ago
|
}).to.deep.equal({
|
||
6 years ago
|
keymaps: {},
|
||
|
search: {
|
||
|
default: "google",
|
||
|
engines: {
|
||
|
google: "https://google.com/search?q={}",
|
||
|
}
|
||
|
},
|
||
|
properties: {
|
||
|
hintchars: "abcdefghijklmnopqrstuvwxyz",
|
||
|
smoothscroll: false,
|
||
|
complete: "sbh"
|
||
|
},
|
||
|
blacklist: []
|
||
|
});
|
||
|
});
|
||
|
|
||
|
it('sets default settings', () => {
|
||
5 years ago
|
let value = Settings.fromJSON({});
|
||
5 years ago
|
expect(value.keymaps.toJSON()).to.not.be.empty;
|
||
5 years ago
|
expect(value.properties.toJSON()).to.not.be.empty;
|
||
5 years ago
|
expect(value.search.defaultEngine).to.be.a('string');
|
||
6 years ago
|
expect(value.search.engines).to.be.an('object');
|
||
5 years ago
|
expect(value.blacklist.toJSON()).to.be.empty;
|
||
6 years ago
|
});
|
||
6 years ago
|
|
||
|
it('throws a TypeError with an unknown field', () => {
|
||
5 years ago
|
expect(() => Settings.fromJSON({ name: 'alice' })).to.throw(TypeError)
|
||
6 years ago
|
});
|
||
6 years ago
|
});
|
||
|
});
|