This commit is contained in:
Rodge Fu 2020-03-17 19:11:54 +08:00
Родитель 34bcd65eed
Коммит a744815627
3 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -137,8 +137,9 @@ export class ActionFormatTable extends Action {
public process(descriptor: CliCommonSchema.CodeModel.NodeDescriptor): void {
let node = descriptor.target;
if (!isNullOrUndefined(this.directiveFormatTable.properties)) {
var n = NodeHelper.setCliProperty(node, CliConst.CLI_FORMATTABLE, {});
n[CliConst.CLI_FORMATTABLE_PROPERTIES] = this.directiveFormatTable.properties;
NodeHelper.setCliProperty(node, CliConst.CLI_FORMATTABLE, {
[CliConst.CLI_FORMATTABLE_PROPERTIES]: this.directiveFormatTable.properties
});
}
}
}

Просмотреть файл

@ -3,7 +3,7 @@ import 'mocha';
import { ActionSet, ActionFlatten } from '../src/plugins/modifier/cliDirectiveAction';
import { M4Node } from '../src/schema';
import { Metadata } from "@azure-tools/codemodel";
import { CliConst } from '../dist/src/schema';
import { NodeHelper } from "../src/nodeHelper"
describe('Test Directive - Action - flatten', function () {
var descriptor = {
@ -18,7 +18,7 @@ describe('Test Directive - Action - flatten', function () {
descriptor.target = new Metadata();
let o = descriptor.target;
action.process(descriptor);
assert.equal(o.extensions[CliConst.FLATTEN_FLAG], false);
assert.equal(NodeHelper.getFlattenedValue(o), false);
action = new ActionFlatten(true);
@ -26,6 +26,6 @@ describe('Test Directive - Action - flatten', function () {
descriptor.target = new Metadata();
o = descriptor.target;
action.process(descriptor);
assert.equal(o.extensions[CliConst.FLATTEN_FLAG], true);
assert.equal(NodeHelper.getFlattenedValue(o), true);
});
});

Просмотреть файл

@ -3,8 +3,8 @@ import 'mocha';
import { ActionSet, ActionFlatten } from '../src/plugins/modifier/cliDirectiveAction';
import { M4Node } from '../src/schema';
import { Metadata } from "@azure-tools/codemodel";
import { CliConst } from '../dist/src/schema';
import { ActionJson } from '../dist/src/plugins/modifier/cliDirectiveAction';
import { NodeHelper } from '../src/nodeHelper';
describe('Test Directive - Action - json', function () {
var descriptor = {
@ -27,7 +27,7 @@ describe('Test Directive - Action - json', function () {
descriptor.target = new Metadata();
o = descriptor.target;
action.process(descriptor);
assert.equal(o.extensions[CliConst.FLATTEN_FLAG], false);
assert.equal(NodeHelper.getFlattenedValue(o), false);
assert.equal(o.language.cli.json, true)
});