Skip to content

Commit

Permalink
Updated index.js to include formatFormulaHTML function and added test…
Browse files Browse the repository at this point in the history
…s for html encoding
  • Loading branch information
joshbtn committed Apr 28, 2017
1 parent 8c2390d commit 92350cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion test/ExcelFormulaUtilities.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ describe("ExcelFormulaUtilities", () => {
describe("#formatFormula", () => {

it("should replace < or > signs in a formula with &lt; and &gt;. Tests fix for Issue #58.", () => {
assert.equals(true, false)
let inputFormula = '"<h1>foo</h1>"';
let expected = '"&lt;h1&gt;foo&lt;/h1&gt;"';
let actual = formula.formatFormula(inputFormula);
assert.equal(actual, expected);
});

it("should parse a formula that doesn't start with a function. Tests fix for Issue #46.", () => {
Expand All @@ -20,6 +23,16 @@ describe("ExcelFormulaUtilities", () => {

});

describe("#formatFormulaHTML", () => {

it("should replace < or > signs in a formula with &lt; and &gt;. Tests fix for Issue #58.", () => {
let inputFormula = '"<h1>foo</h1>"';
let expected = '=<span class="quote_mark">"</span><span class="text">&lt;h1&gt;foo&lt;/h1&gt;</span><span class="quote_mark">"</span>';
let actual = formula.formatFormulaHTML(inputFormula);
assert.equal(actual, expected);
});
});

describe("#toCSharp", () => {
it("should parse a formula that doesn't start with a function. Tests fix for Issue #46.", () => {
let inputFormula='=A5';
Expand Down

0 comments on commit 92350cd

Please sign in to comment.