action method

  1. @override
bool action(
  1. Function action,
  2. covariant C cell, {
  3. Arguments? arguments,
})
inherited

Validates an action against test rules

Implementation

@override
bool action(Function action, covariant C cell, {Arguments? arguments}) {
  if (cell is Unmodifiable && cell.modifiable.contains(action)) {
    return false;
  }

  final checked = Set<TestRule>.identity();

  bool process(TestRule rule) {
    if (rule is TestObject<C>) {
      for (var r in rule) {
        if (process(r) == false) {
          return false;
        }
      }
    }

    if (rule is TestActionRule<C> && checked.add(rule)) {
      try {
        if (rule.action(action, cell, arguments: arguments) == false) {
          return false;
        }
      } catch(_) {}
    }
    return true;
  }
  return process(this);

}