Skip to content

Commit

Permalink
fix event reg (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brunoon authored and yenshih committed Mar 6, 2019
1 parent ff35097 commit 1e6da76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/mip/src/util/event-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const PARSE_REG = /^(\w+):\s*([\w-]+)\.([\w-$]+)(?:\((.+)\))?$/
* @inner
* @type {RegExp}
*/
const EVENT_ARG_REG = /^event(\.[a-zA-Z_][\w_]+)+$/g
const EVENT_ARG_REG = /^event(\.[a-zA-Z_][\w_]*)+$/g
// const EVENT_ARG_REG_FOR_OBJECT = /(:\s*)(event(\.[a-zA-Z]\w+)+)(\s*[,}])/g

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/mip/test/specs/util/event-action.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ describe('split', () => {
describe('handleArguments', () => {
let action = new EventAction()
let event = {
_: 0,
one: 1,
two: 2,
nest: {
Expand All @@ -204,6 +205,7 @@ describe('handleArguments', () => {
bool: true
}
it('should get event value', () => {
expect(action.handleArguments('event._', event)).to.equal('0')
expect(action.handleArguments('event.one', event)).to.equal('1')
expect(action.handleArguments(' event.one ', event)).to.equal('1')
expect(action.handleArguments('event.three', event)).to.equal('undefined')
Expand Down

0 comments on commit 1e6da76

Please sign in to comment.