diff --git a/src/health-message/demo.html b/src/health-message/demo.html index e69de29b..82d96137 100644 --- a/src/health-message/demo.html +++ b/src/health-message/demo.html @@ -0,0 +1,36 @@ + + + + <health-message> + + + +

Health-Message Component Demo

+
+

alertClass: danger

+
+
+

alertClass: warning

+
+ + + + + + \ No newline at end of file diff --git a/src/health-message/health-message-test.html b/src/health-message/health-message-test.html index e69de29b..7af2b5c6 100644 --- a/src/health-message/health-message-test.html +++ b/src/health-message/health-message-test.html @@ -0,0 +1,15 @@ + + + +Author App Tests + +
+
+ + + + \ No newline at end of file diff --git a/src/health-message/health-message-test.js b/src/health-message/health-message-test.js index e69de29b..a09f6009 100644 --- a/src/health-message/health-message-test.js +++ b/src/health-message/health-message-test.js @@ -0,0 +1,60 @@ +import { HealthMessageVM } from './health-message' +import stache from 'can-stache' +import canViewModel from 'can-view-model' +import { assert } from 'chai' +import $ from 'jquery' + +import 'steal-mocha' + +describe('', () => { + describe('viewModel', () => { + let vm + const testProps = { + showMessage: true, + alertClass: 'danger', + message: 'Danger Zone!' + } + + beforeEach(() => { + vm = new HealthMessageVM(testProps) + }) + + it('passes simple smoke test', () => { + const expectedMessage = 'Danger Zone!' + const expectedAlertClass = 'danger' + const expectedShowMessage = true + + assert.equal(vm.message, expectedMessage, 'message should show Danger Zone!') + assert.equal(vm.alertClass, expectedAlertClass, 'alertClass should be danger') + assert.equal(vm.showMessage, expectedShowMessage, 'showMessage should be true') + }) + }) + + describe('Component', () => { + // let vm + + afterEach(() => { + document.getElementById('test-area').innerHTML = '' + }) + + it('shows a warning level message', () => { + const render = (data) => { + const tpl = stache(` + `) + + document.querySelector('#test-area').appendChild(tpl(data)) + + return canViewModel('health-message') + } + + render() + + const messageEl = $('health-message') + assert.isTrue(messageEl.is(':visible'), 'should be visible') + }) + }) +}) diff --git a/test/test.js b/test/test.js index c0c77aa1..6195ceaf 100644 --- a/test/test.js +++ b/test/test.js @@ -16,6 +16,7 @@ import 'a2jauthor/src/report/report-test' import 'a2jauthor/legacy/a2j-legacy-tests' import 'a2jauthor/src/utils/tests/' import 'a2jauthor/src/vertical-navbar/vertical-navbar-test' +import 'a2jauthor/src/health-message/health-message-test' import 'a2jauthor/src/pages-tab/components/var-picker/field/var-picker-field-test' // import 'a2jauthor/src/templates/templates-test' // import 'a2jauthor/src/templates/edit/edit-test'