|
253 | 253 | $vim.feedkeys "$hhgf" |
254 | 254 | $vim.echo(%(bufname("%"))).must_equal target |
255 | 255 | end |
| 256 | + |
| 257 | + it "must edit ./other.android.js relative to file" do |
| 258 | + touch File.join(@dir, "foo", "index.js"), %(require("./other")) |
| 259 | + touch File.join(@dir, "foo", "other.android.js") |
| 260 | + |
| 261 | + $vim.edit File.join(@dir, "foo", "index.js") |
| 262 | + $vim.feedkeys "f.gf" |
| 263 | + |
| 264 | + bufname = File.realpath($vim.echo(%(bufname("%")))) |
| 265 | + bufname.must_equal File.join(@dir, "foo", "other.android.js") |
| 266 | + end |
| 267 | + |
| 268 | + it "must edit ./other.ios.js relative to file" do |
| 269 | + touch File.join(@dir, "foo", "index.js"), %(require("./other")) |
| 270 | + touch File.join(@dir, "foo", "other.ios.js") |
| 271 | + |
| 272 | + $vim.edit File.join(@dir, "foo", "index.js") |
| 273 | + $vim.feedkeys "f.gf" |
| 274 | + |
| 275 | + bufname = File.realpath($vim.echo(%(bufname("%")))) |
| 276 | + bufname.must_equal File.join(@dir, "foo", "other.ios.js") |
| 277 | + end |
| 278 | + |
| 279 | + it "must edit ./other.ios.js relative to file if both android and ios exist" do |
| 280 | + touch File.join(@dir, "foo", "index.js"), %(require("./other")) |
| 281 | + touch File.join(@dir, "foo", "other.ios.js") |
| 282 | + touch File.join(@dir, "foo", "other.android.js") |
| 283 | + |
| 284 | + $vim.edit File.join(@dir, "foo", "index.js") |
| 285 | + $vim.feedkeys "f.gf" |
| 286 | + |
| 287 | + bufname = File.realpath($vim.echo(%(bufname("%")))) |
| 288 | + bufname.must_equal File.join(@dir, "foo", "other.ios.js") |
| 289 | + end |
| 290 | + |
| 291 | + it "must edit ./node_modules/foo/index.android.js given foo" do |
| 292 | + touch File.join(@dir, "index.js"), %(require("foo")) |
| 293 | + target = touch File.join(@dir, "node_modules", "foo", "index.android.js") |
| 294 | + |
| 295 | + $vim.edit File.join(@dir, "index.js") |
| 296 | + $vim.feedkeys "$hhgf" |
| 297 | + $vim.echo(%(bufname("%"))).must_equal target |
| 298 | + end |
| 299 | + |
| 300 | + it "must edit ./bar.js given packagejsonname/bar" do |
| 301 | + touch File.join(@dir, "foo", "index.js"), %(require("packagejsonname/bar")) |
| 302 | + touch File.join(@dir, "package.json"), %({ "name": "packagejsonname" }) |
| 303 | + touch File.join(@dir, "bar.js") |
| 304 | + |
| 305 | + $vim.edit File.join(@dir, "foo", "index.js") |
| 306 | + $vim.feedkeys "$hhgf" |
| 307 | + |
| 308 | + bufname = File.realpath($vim.echo(%(bufname("%")))) |
| 309 | + bufname.must_equal File.join(@dir, "bar.js") |
| 310 | + end |
| 311 | + |
| 312 | + it "must edit ./node_modules/foo/bar.js given foo/bar" do |
| 313 | + touch File.join(@dir, "index.js"), %(require("foo/bar")) |
| 314 | + touch File.join(@dir, "package.json"), %({ "name": "packagejsonname" }) |
| 315 | + target = touch File.join(@dir, "node_modules", "foo", "bar.js") |
| 316 | + |
| 317 | + $vim.edit File.join(@dir, "index.js") |
| 318 | + $vim.feedkeys "$hhgf" |
| 319 | + $vim.echo(%(bufname("%"))).must_equal target |
| 320 | + end |
| 321 | + |
| 322 | + it "must edit ./bar.js given packagejsonname/bar event if module exists" do |
| 323 | + touch File.join(@dir, "foo", "index.js"), %(require("packagejsonname/bar")) |
| 324 | + touch File.join(@dir, "package.json"), %({ "name": "packagejsonname" }) |
| 325 | + target = touch File.join(@dir, "node_modules", "packagejsonname", "bar.js") |
| 326 | + touch File.join(@dir, "bar.js") |
| 327 | + |
| 328 | + $vim.edit File.join(@dir, "foo", "index.js") |
| 329 | + $vim.feedkeys "$hhgf" |
| 330 | + |
| 331 | + bufname = File.realpath($vim.echo(%(bufname("%")))) |
| 332 | + bufname.must_equal File.join(@dir, "bar.js") |
| 333 | + end |
256 | 334 | end |
257 | 335 |
|
258 | 336 | describe "Goto file with split" do |
|
0 commit comments