aboutsummaryrefslogtreecommitdiff
path: root/tests/options-reader.tests.js
blob: 073b3a592fd923c31ffe123c4f40b2d37ecf565c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var assert = require("assert");

var style = require("../").style;
var optionsReader = require("../lib/options-reader");
var standardOptions = optionsReader._standardOptions;
var readOptions = optionsReader.readOptions;


describe('readOptions', function() {
    it('standard options are used if options is undefined', function() {
        assert.deepEqual(standardOptions, readOptions(undefined));
    });
    
    it('standard options are used if options is empty', function() {
        assert.deepEqual(standardOptions, readOptions({}));
    });
    
    it('custom style mappings are prepended to standard style mappings', function() {
        var options = readOptions({
            styleMap: "p.SectionTitle => h2"
        });
        assert.deepEqual(style("p.SectionTitle => h2"), options.styleMap[0]);
        assert.deepEqual(standardOptions.styleMap, options.styleMap.slice(1));
    });
});

function last(array) {
    return array[array.length - 1];
}