diff --git a/spec/converter-spec.js b/spec/converter-spec.js index b94d9f793..14a304399 100644 --- a/spec/converter-spec.js +++ b/spec/converter-spec.js @@ -19,7 +19,7 @@ describe('Template converter', function() { beforeAll(function() { mockery.registerMock('jquery', require('cheerio').load('')); - mockery.registerAllowables(['fs', '../src/js/converter/declarations.js', '../src/js/converter/model.js', '../src/js/converter/parser.js', 'console', './utils.js', './domutils.js', 'console', '../node_modules/mensch', './lib/lexer', './lib/parser', './lib/stringify', './debug', 'jsep', './declarations.js', 'mensch/lib/parser.js', 'mensch/lib/parser.js', './lexer', './stylesheet.js', './model.js']); + mockery.registerAllowables(['fs', '../src/js/converter/checkdefs.js', '../src/js/converter/declarations.js', '../src/js/converter/model.js', '../src/js/converter/parser.js', 'console', './utils.js', './domutils.js', 'console', '../node_modules/mensch', './lib/lexer', './lib/parser', './lib/stringify', './debug', 'jsep', './declarations.js', 'mensch/lib/parser.js', 'mensch/lib/parser.js', './lexer', './stylesheet.js', './model.js']); mockery.enable(); _parseTemplate = function(html) { @@ -249,6 +249,55 @@ describe('Template converter', function() { }); + it('should detect missing default values', function() { + var parseData = _parseTemplate('\ + \ +
'); + + var checkDefs = require('../src/js/converter/checkdefs.js'); + var ok = checkDefs(parseData.templateDef._defs); + expect(ok).toBe(false); + }); + + it('should detect data-ko-properties default value declarations', function() { + var parseData = _parseTemplate('\ + \ +
'); + + var checkDefs = require('../src/js/converter/checkdefs.js'); + var ok = checkDefs(parseData.templateDef._defs); + + expect(ok).toBe(true); + }); + + it('should detect -ko-blockdefs default value declarations in properties', function() { + var parseData = _parseTemplate('\ + \ +
'); + + var checkDefs = require('../src/js/converter/checkdefs.js'); + var ok = checkDefs(parseData.templateDef._defs); + expect(ok).toBe(true); + }); + afterAll(function() { mockery.disable(); mockery.deregisterAll();