From f31ff0b9e8d9ff2924d4e8867bdfd25caaa95c29 Mon Sep 17 00:00:00 2001 From: Eric Rowell Date: Sun, 15 Sep 2013 22:59:09 -0700 Subject: [PATCH] getTrace() can now operate in strict and relaxed modes. with relaxed mode, we can now also do a basic context trace test on renderings that may have different parameters in different browsers --- src/Context.js | 62 +++++++++++++++++++++++++++----- src/shapes/Text.js | 2 +- test/unit/Layer-test.js | 2 +- test/unit/Shape-test.js | 2 +- test/unit/plugins/Label-test.js | 10 +++--- test/unit/plugins/Path-test.js | 6 ++-- test/unit/shapes/Blob-test.js | 2 +- test/unit/shapes/Circle-test.js | 2 +- test/unit/shapes/Ellipse-test.js | 2 +- test/unit/shapes/Image-test.js | 5 +++ test/unit/shapes/Rect-test.js | 7 ++-- test/unit/shapes/Spline-test.js | 2 +- test/unit/shapes/Wedge-test.js | 2 +- 13 files changed, 79 insertions(+), 27 deletions(-) diff --git a/src/Context.js b/src/Context.js index 7bade281..a453c6f5 100644 --- a/src/Context.js +++ b/src/Context.js @@ -4,6 +4,8 @@ CLOSE_PAREN = ')', OPEN_PAREN_BRACKET = '([', CLOSE_BRACKET_PAREN = '])', + SEMICOLON = ';', + DOUBLE_PAREN = '()', EMPTY_STRING = '', EQUALS = '=', SET = 'set', @@ -63,10 +65,49 @@ * get context trace if trace is enabled * @method * @memberof Kinetic.Context.prototype + * @param {Boolean} relaxed if false, return strict context trace, which includes method names, method parameters + * properties, and property values. If true, return relaxed context trace, which only returns method names and + * properites. * @returns {String} */ - getTrace: function() { - return this.traceArr.join(';'); + getTrace: function(relaxed) { + var traceArr = this.traceArr, + len = traceArr.length, + str = '', + n, trace, method, args; + + for (n=0; n