Skip to content

Commit 9ec41e3

Browse files
committed
fix tests
1 parent 80eaedb commit 9ec41e3

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

lib/doc/cell.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,24 +584,31 @@ class HyperlinkValue {
584584
type: Cell.Types.Hyperlink,
585585
text: value ? value.text : undefined,
586586
hyperlink: value ? value.hyperlink : undefined,
587-
tooltip: value.tooltip,
588587
};
588+
if (value && value.tooltip) {
589+
this.model.tooltip = value.tooltip;
590+
}
589591
}
590592

591593
get value() {
592-
return {
594+
const v = {
593595
text: this.model.text,
594596
hyperlink: this.model.hyperlink,
595-
tooltip: this.model.tooltip,
596597
};
598+
if (this.model.tooltip) {
599+
v.tooltip = this.model.tooltip;
600+
}
601+
return v;
597602
}
598603

599604
set value(value) {
600605
this.model = {
601606
text: value.text,
602607
hyperlink: value.hyperlink,
603-
tooltip: value.tooltip,
604608
};
609+
if (value.tooltip) {
610+
this.model.tooltip = value.tooltip;
611+
}
605612
}
606613

607614
get text() {

spec/unit/xlsx/xform/test-xform-helper.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const Sax = require('sax');
2-
const _ = require('../../../utils/under-dash');
2+
const {cloneDeep, each} = require('../../../utils/under-dash');
33

44
const XmlStream = verquire('utils/xml-stream');
55
const CompositeXform = verquire('xlsx/xform/composite-xform');
@@ -9,7 +9,7 @@ function getExpectation(expectation, name) {
99
if (!expectation.hasOwnProperty(name)) {
1010
throw new Error(`Expectation missing required field: ${name}`);
1111
}
12-
return _.cloneDeep(expectation[name]);
12+
return cloneDeep(expectation[name]);
1313
}
1414

1515
// ===============================================================================================================
@@ -28,7 +28,7 @@ const its = {
2828

2929
const xform = expectation.create();
3030
xform.prepare(model, expectation.options);
31-
expect(_.cloneDeep(model)).to.deep.equal(result);
31+
expect(cloneDeep(model, false)).to.deep.equal(result);
3232
resolve();
3333
}));
3434
},
@@ -137,7 +137,7 @@ const its = {
137137
// console.log('expected Model', JSON.stringify(result));
138138

139139
// eliminate the undefined
140-
const clone = _.cloneDeep(model, false);
140+
const clone = cloneDeep(model, false);
141141

142142
// console.log('result', JSON.stringify(clone));
143143
// console.log('expect', JSON.stringify(result));
@@ -162,7 +162,7 @@ const its = {
162162
.parse(parser)
163163
.then(model => {
164164
// eliminate the undefined
165-
const clone = _.cloneDeep(model, false);
165+
const clone = cloneDeep(model, false);
166166

167167
// console.log('result', JSON.stringify(clone));
168168
// console.log('expect', JSON.stringify(result));
@@ -185,7 +185,7 @@ const its = {
185185
xform.reconcile(model, expectation.options);
186186

187187
// eliminate the undefined
188-
const clone = _.cloneDeep(model, false);
188+
const clone = cloneDeep(model, false);
189189

190190
expect(clone).to.deep.equal(result);
191191
resolve();
@@ -194,10 +194,10 @@ const its = {
194194
};
195195

196196
function testXform(expectations) {
197-
_.each(expectations, expectation => {
197+
each(expectations, expectation => {
198198
const tests = getExpectation(expectation, 'tests');
199199
describe(expectation.title, () => {
200-
_.each(tests, test => {
200+
each(tests, test => {
201201
its[test](expectation);
202202
});
203203
});

0 commit comments

Comments
 (0)