diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-09-27 13:35:47 +1000 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-09-27 13:35:47 +1000 |
commit | 99e176f76332b47a6c026dbd9dcf7742191b8b29 (patch) | |
tree | 18fe3fbadb6fde0ca05b75ae09d7510de0a17ed0 /spec | |
parent | 3f78cb81973f9c6c9a0754a555c939e81d24a1ff (diff) | |
download | svg.js-99e176f76332b47a6c026dbd9dcf7742191b8b29.tar.gz svg.js-99e176f76332b47a6c026dbd9dcf7742191b8b29.zip |
fix `clone()` to return the correct instance (#1154)
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec/elements/Dom.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/spec/elements/Dom.js b/spec/spec/elements/Dom.js index 2e36c92..deb665a 100644 --- a/spec/spec/elements/Dom.js +++ b/spec/spec/elements/Dom.js @@ -172,6 +172,12 @@ describe('Dom.js', function () { expect(clone.get(0).id()).not.toBe(rect.id()) expect(clone.id()).not.toBe(group.id()) }) + + it('returns an instance of the same class the method was called on', () => { + const rect = new Dom(create('rect')) + expect(rect.constructor).toBe(Dom) + expect(rect.clone().constructor).toBe(Dom) + }) }) describe('each()', () => { |