howl.inputs.ProjectFile

registers a "project_file" input

assert.not_nil inputs.project_file

when a file and project is available

root = nil
input = nil
file = nil

before_each ->
  root = File.tmpdir!
  root\join('subdir')\mkdir!
  root\join('subdir/foo')\touch!
  root\join('simple.txt')\touch!
  file = root\join('Makefile')
  file\touch!

  app.editor = buffer: :file
  Project.add_root root
  input = inputs.project_file!

after_each ->
  Project.remove_root root
  root\delete_all!

.should_complete() returns true

assert.is_true input\should_complete!

.complete() returns a sorted list of relative paths

comps = input\complete ''
assert.same {
  'Makefile',
  'simple.txt',
  'subdir/foo'
}, comps

.value_for(path) returns a File

assert.equal input\value_for('Makefile'), file

when a file is available but not a project

input = nil
file = nil

before_each ->
  file = File.tmpfile!
  app.editor = buffer: :file
  input = inputs.project_file!

after_each -> file\delete!

.complete() returns an empty table

assert.same input\complete(''), {}

.value_for(path) returns nil

assert.is_nil input\value_for 'foo'

when file is not available

before_each -> app.editor = buffer: {}

.complete() returns an empty table

assert.same inputs.project_file!\complete(''), {}

.value_for(path) returns nil

assert.is_nil inputs.project_file!\value_for 'foo'