diff --git a/src/css/styles.css b/src/css/styles.css index 436e3d2..83f676e 100644 --- a/src/css/styles.css +++ b/src/css/styles.css @@ -17,7 +17,7 @@ code { font-size: 1.2em; font-weight: bold; } .expression .label { font-weight: bold; padding-right: 5px; text-align: right; } .expression .bin { letter-spacing: 3px; } .expression .byte { margin: 0 3px; } -.expression .result td { border-top: dotted 1px gray; } +.expression-result td { border-top: dotted 1px gray; } .expression { font-size: 1.5em; font-family: monospace } .expression .prefix { font-weight: normal; display: none; font-size: 0.9em } .expression .other { font-size: 0.9em} diff --git a/src/index.html b/src/index.html index c02c190..abd25ab 100644 --- a/src/index.html +++ b/src/index.html @@ -132,7 +132,7 @@ {m.operand1.bin.padLeft(m.bitsSize, '0')} {m.operand1.other} - + {m.string.replace(/\s/g,'')}={m.result.input} {m.result.bin.padLeft(m.bitsSize, '0')} {m.result.other} @@ -147,7 +147,7 @@ {m.operand1.bin.padLeft(m.bitsSize, '0')} {m.operand1.other} - + {m.sign}{m.operand1.input}={m.result.input} {m.result.bin.padLeft(m.bitsSize, '0')} {m.result.other} @@ -169,7 +169,7 @@ {m.operand2.bin.padLeft(m.bitsSize, '0')} {m.operand2.other} - + = {m.result.input} {m.result.bin.padLeft(m.bitsSize, '0')} diff --git a/tests/e2e/spec.js b/tests/e2e/spec.js index 0344dd7..4bf7e84 100644 --- a/tests/e2e/spec.js +++ b/tests/e2e/spec.js @@ -79,6 +79,28 @@ describe('launch of application', function() { { label: '~1=-2', bin:'11111111111111111111111111111110', other: '-0x2'}]) }); + it('should execute multiple expressions from hash arguments', function() { + + var url = appUrl + "||16,15||16&15"; + console.log('accessing url: ', url); + + return driver.get(url) + .then(function() { return driver.navigate().refresh(); }) + .then(assertNoErrors) + .then(function() { + return assertMultipleExpressionResults(driver, [ + //16&15 + [{ label: '16', bin:'00010000', other: '0x10'}, + { label: '15', bin:'00001111', other: '0xf'}, + { label: '0', bin:'00000000', other: '0x0'}], + + //16 15 + [{ label: '16', bin:'00010000', other: '0x10'}, + { label: '15', bin:'00001111', other: '0xf'}] + ]) + }) + }); + it('should do OR operation', function() { return assertOperation('1|2', @@ -87,6 +109,8 @@ describe('launch of application', function() { { label: '3', bin:'00000011', other: '0x3'}]) }); + + it('should do prefer hex result', function() { return assertOperation('1|0x2', @@ -95,6 +119,7 @@ describe('launch of application', function() { { label: '0x3', bin:'00000011', other: '3'}]) }); + it('should create hashlink', function() { var expected = [{ label: '1', bin:'00000001', other: '0x1'}, { label: '0x2', bin:'00000010', other: '2'}, @@ -139,12 +164,27 @@ function sendCommand(cmd) { }); } -function assertNoErrors(cmd) { +function assertNoErrors() { return driver.findElements(By.css('.result .error')).then(function(els) { expect(els.length).toBe(0, "There should be no errors"); }); } +function assertMultipleExpressionResults(contaier, array) { + + return contaier.findElements(By.css('.result')) + .then(function (results){ + expect(results.length).toBe(array.length, 'Expression results number mismatch'); + var all= null, cur; + for(var i=0; i