From 334d9c73c2f74679a93b1d7b3e39b614f6444faa Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Mon, 12 Nov 2018 13:59:07 +0100 Subject: reworked parents so that it is useful now, changelog --- spec/spec/element.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'spec') diff --git a/spec/spec/element.js b/spec/spec/element.js index 1cb754e..b36ea82 100644 --- a/spec/spec/element.js +++ b/spec/spec/element.js @@ -651,15 +651,16 @@ describe('Element', function() { }) describe('parents()', function() { - it('returns array of parent up to but not including the dom element filtered by type', function() { + it('returns array of parents until the passed element or document', function() { var group1 = draw.group().addClass('test') , group2 = group1.group() - , rect = group2.rect(100,100) + , group3 = group2.group() + , rect = group3.rect(100,100) - expect(rect.parents('.test')[0]).toBe(group1) - expect(rect.parents(SVG.G)[0]).toBe(group2) - expect(rect.parents(SVG.G)[1]).toBe(group1) - expect(rect.parents().length).toBe(3) + expect(rect.parents('.test')[0]).toBe(group3) + expect(rect.parents('.test')[1]).toBe(group2) + expect(rect.parents(group2)[0]).toBe(group3) + expect(rect.parents(group1).length).toBe(2) }) }) -- cgit v1.2.3