-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor findVarUsage to CanJS with tests
- Loading branch information
1 parent
9a50089
commit 71f163d
Showing
9 changed files
with
507 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<title>Author Editor Tests</title> | ||
|
||
<div id="mocha"></div> | ||
<div id="test-area"></div> | ||
|
||
<script type="text/javascript"> | ||
window.less = {async: true, fileSync: true}; | ||
</script> | ||
|
||
<script src="../../node_modules/steal/steal.js" | ||
mocha="bdd" | ||
main="a2jauthor/src/variables/editor/editor-test"> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { assert } from 'chai' | ||
import { VariableEditorVM } from './editor' | ||
import { findVarUsage } from './findVarUsage' | ||
import { testPages, expectedHtml } from './testPages' | ||
|
||
import 'steal-mocha' | ||
|
||
describe('<editor>', () => { | ||
describe('viewModel', () => { | ||
let vm | ||
|
||
beforeEach(() => { | ||
vm = new VariableEditorVM() | ||
}) | ||
it('smoketest', () => { | ||
assert.equal(vm.initialVariable, undefined, 'should start with no initial variables') | ||
}) | ||
}) | ||
|
||
describe('findVarUsage', () => { | ||
it('gathers usage on Page, Field, and Button level property values using variables', function () { | ||
const { pageCount, html } = findVarUsage('Foo', testPages) | ||
|
||
assert.equal(pageCount, 3, 'should return pageCount for variable usage across pages, fields, macros, buttons, and logic') | ||
assert.equal(html, expectedHtml, 'should return html message for found locations') | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.