import testRule from 'stylelint-test-rule-tape'

import declarationStrictValue, { ruleName } from '../src'

const { rule } = declarationStrictValue

// ignore keywords hash
testRule(rule, {
  ruleName,
  skipBasicChecks: true,

  config: [['/color$/', 'fill', 'z-index'], {
    ignoreKeywords: {
      '/color$/': ['transparent', 'currentColor'],
      'fill': 'inherit',
      'z-index': 0,
    },
  }],

  accept: [
    { code: '.foo { color: transparent; }' },
    { code: '.foo { color: currentColor; }' },
    { code: '.foo { background-color: transparent; }' },
    { code: '.foo { background-color: currentColor; }' },
    { code: '.foo { border-color: transparent; }' },
    { code: '.foo { border-color: currentColor; }' },
    { code: '.foo { fill: inherit; }' },
    { code: '.foo { z-index: 0; }' },
  ],

  reject: [
    {
      code: '.foo { color: inherit; }',
      message: `Expected variable, function or keyword for "inherit" of "color" (${ruleName})`,
      line: 1,
      column: 8,
    },
    {
      code: '.foo { fill: currentColor; }',
      message: `Expected variable, function or keyword for "currentColor" of "fill" (${ruleName})`,
      line: 1,
      column: 8,
    },
    {
      code: '.foo { z-index: 1; }',
      message: `Expected variable, function or keyword for "1" of "z-index" (${ruleName})`,
      line: 1,
      column: 8,
    },
  ],
})

@@ -266,13 +266,24 @@
 dex'
+, 'display'
 %5D, %7B%0A
-
     
@@ -396,16 +396,37 @@
 ex': 0,%0A
+      '': 'initial',%0A
     %7D,%0A 
@@ -833,24 +833,68 @@
 x: 0; %7D' %7D,%0A
+    %7B code: '.foo %7B display: initial; %7D' %7D,%0A
   %5D,%0A%0A  reje
@@ -1307,24 +1307,24 @@
 dex: 1; %7D',%0A
-
       messag
@@ -1438,20 +1438,201 @@
 : 8,%0A    %7D,%0A
+    %7B%0A      code: '.foo %7B display: block; %7D',%0A      message: %60Expected variable, function or keyword for %22block%22 of %22display%22 ($%7BruleName%7D)%60,%0A      line: 1,%0A      column: 8,%0A    %7D,%0A
   %5D,%0A%7D)%0A

fix coverage of keyword hash